S
Sammy
Hello:
Surprise! My macro doesn't work. I have three autotext entries named
Text1, Test2 and Test3. I have three bookmark locations in my document,
bkHere1, bkHere2 and bkHere3. I could probably make this happen by going to
the bookmark and inserting the autotext but I wanted to try using the Range
object instead.
As you can see I'm trying to define the ranges and then insert the autotext.
In my final macro the user will be able to select one, two or all three of
the autotext entries from a dialog box (I have this part of the macro). The
autotext entries need to come in order, regardless of which ones they select
(so if they choose 2 and 3 they need to appear in that order).
Can you help? THANKS!
Sub InsertAutoTextEntry()
Dim rngDoc1 As Range
Dim rngDoc2 As Range
Dim rngdoc3 As Range
Set rngDoc1 = ActiveDocument.Range.Bookmarks("bkHere1")
Set rngDoc2 = ActiveDocument.Range.Bookmarks("bkHere2")
Set rngdoc3 = ActiveDocument.Range.Bookmarks("bkHere3")
ActiveDocument.AttachedTemplate.AutoTextEntries("test1").Insert _
Where:=rngDoc1, RichText:=True
End Sub
Surprise! My macro doesn't work. I have three autotext entries named
Text1, Test2 and Test3. I have three bookmark locations in my document,
bkHere1, bkHere2 and bkHere3. I could probably make this happen by going to
the bookmark and inserting the autotext but I wanted to try using the Range
object instead.
As you can see I'm trying to define the ranges and then insert the autotext.
In my final macro the user will be able to select one, two or all three of
the autotext entries from a dialog box (I have this part of the macro). The
autotext entries need to come in order, regardless of which ones they select
(so if they choose 2 and 3 they need to appear in that order).
Can you help? THANKS!
Sub InsertAutoTextEntry()
Dim rngDoc1 As Range
Dim rngDoc2 As Range
Dim rngdoc3 As Range
Set rngDoc1 = ActiveDocument.Range.Bookmarks("bkHere1")
Set rngDoc2 = ActiveDocument.Range.Bookmarks("bkHere2")
Set rngdoc3 = ActiveDocument.Range.Bookmarks("bkHere3")
ActiveDocument.AttachedTemplate.AutoTextEntries("test1").Insert _
Where:=rngDoc1, RichText:=True
End Sub