E
EllenM
Hello, I am trying to create a macro to work with a Word template that
contains placeholders for text that will change from document to document
based on this template. I discovered bookmarks as a possible solution but
have no clue how to use them. Ultimately, I would like my macro to prompt the
user to enter data into a userform (data that will go into these bookmarks).
As an initial step, I am trying to run the following code which I presume
inserts bookmarks in a Word document but I get a runtime error 5941. Any
suggestions? Thanks
Dim bmRange As Range
Set bmRange = ActiveDocument.Bookmarks("myBookmark").Range
bmRange.Text = "Inserted Text"
ActiveDocument.Bookmarks.Add _
Name:="myBookmark", _
Range:=bmRange
Thanks for your help,
Ellen
contains placeholders for text that will change from document to document
based on this template. I discovered bookmarks as a possible solution but
have no clue how to use them. Ultimately, I would like my macro to prompt the
user to enter data into a userform (data that will go into these bookmarks).
As an initial step, I am trying to run the following code which I presume
inserts bookmarks in a Word document but I get a runtime error 5941. Any
suggestions? Thanks
Dim bmRange As Range
Set bmRange = ActiveDocument.Bookmarks("myBookmark").Range
bmRange.Text = "Inserted Text"
ActiveDocument.Bookmarks.Add _
Name:="myBookmark", _
Range:=bmRange
Thanks for your help,
Ellen