I find working with bookmarks as anchors to be quite annoying especially when working with those bookmarks to populate text in the document from the userform. I prefer to use content controls and populate them either indirectly from linked XML or directly in code.
Staying with bookmarks, if you want to add one, you need to provide a range for it to go and close the quotes on its name. For instance, this line won't work
ActiveDocument.Bookmarks.Add Name:="bmDA
but this should
ActiveDocument.Bookmarks.Add Name:="bmDA", Range:=ActiveDocument.Paragraphs(1).Range
The act of setting the text value content of a bookmark actually removes the bookmark [see Sentence #1 above] so these lines of code put text in the document but also remove the bookmark
Set Temp = ActiveDocument.Bookmarks("bmDA").Range
Temp.Text = Me.PNBox.Value
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
|