B
bw
http://word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm
The site above has provided me with the following code (notice the error on
line 5):
Sub AddPeriod()
Dim BMRange As Range
'Identify current Bookmark range and insert text
Set BMRange = ActiveDocument.Bookmarks("Text1").Range
BMRange.Text = "Hello world" 'I get an error on this line: "Run-time
error '6028': The range cannot be deleted."
'Re-insert the bookmark
ActiveDocument.Bookmarks.Add "Text1", BMRange
End Sub
I simply put two field forms on a "1TestForm" template, the first of which
executes (on exit) the "AddPeriod" macro above, locked the form, saved the
template, then open a new document based on "1TestForm" template.
I have tried this with code that unprotects and protects the form (and still
leaves the data intact), but I always get this error.
Well, the frustration comes from the fact that I made it work ONE TIME, but
I now don't know how!!!
Help would be appreciated..
Thanks,
Bernie
The site above has provided me with the following code (notice the error on
line 5):
Sub AddPeriod()
Dim BMRange As Range
'Identify current Bookmark range and insert text
Set BMRange = ActiveDocument.Bookmarks("Text1").Range
BMRange.Text = "Hello world" 'I get an error on this line: "Run-time
error '6028': The range cannot be deleted."
'Re-insert the bookmark
ActiveDocument.Bookmarks.Add "Text1", BMRange
End Sub
I simply put two field forms on a "1TestForm" template, the first of which
executes (on exit) the "AddPeriod" macro above, locked the form, saved the
template, then open a new document based on "1TestForm" template.
I have tried this with code that unprotects and protects the form (and still
leaves the data intact), but I always get this error.
Well, the frustration comes from the fact that I made it work ONE TIME, but
I now don't know how!!!
Help would be appreciated..
Thanks,
Bernie