Jay
Tue May 06 06:37:22 PDT 2008
CollegeProf wrote:
>> If each of these comments consists of unchanging text, you should
>> store each one as an AutoText entry. Then your menu items can simply
>> insert the appropriate entry, which will contain the formatted URL.
>> No macros are needed.
>>
>> Start by entering the whole comment into an ordinary document, or
>> selecting it in a document where it already exists. Press Alt+F3 and
>> give the entry a name. Repeat that for each type of comment. The
>> entries will be stored in your Normal.dot template.
>>
>> To make the menu entries, open the Tools > Customize dialog and
>> select the AutoText category. The names of the entries will appear
>> in the Commands column. Drag a name from that column and drop it on
>> the menu of your choice.
>
> Ah, yes, I see how that would work. Using that system, I'd have to
> insert the comment, then choose the autotext to fill the comment
> bubble. I was using macros to create a one step process, recording
> inserting the comment as part of the macro itself. Is there any way
> to edit a macro, in VBE perhaps, to include a hyperlink in the text
> of a comment?
Of course there's a way, but it isn't anything the recorder will ever be
able to handle.
What I'll show below is a single subroutine (marked "Private" so it won't
appear in the list in the Macros dialog) that creates a comment and inserts
an AutoText entry into it. Below that are examples of macros that call the
subroutine, each macro passing a different AutoText entry name to be
inserted. These macros are the ones that you would add to the menu, giving
them appropriate names so the menu items will be understandable.
Private Sub InsertATComment(AutoTextEntryName As String)
Dim myComm As Comment
Set myComm = ActiveDocument.Comments.Add(Range:=Selection.Range)
NormalTemplate.AutoTextEntries(AutoTextEntryName) _
.Insert Where:=myComm.Range, RichText:=True
Set myComm = Nothing
End Sub
Sub InsertCommentA()
InsertATComment AutoTextEntryName:="CommentA"
End Sub
Sub InsertCommentB()
InsertATComment AutoTextEntryName:="CommentB"
End Sub
For example, if you've stored a comment as an AutoText entry with the name
SentenceFragment, you could make this macro to put in the menu:
Sub SentenceFragmentComment()
InsertATComment AutoTextEntryName:="SentenceFragment"
End Sub
Put the SentenceFragmentComment macro on the menu. When you select it, the
SentenceFragment comment will be inserted at the current selection.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.