![]() |
#2
|
||||
|
||||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
wardw | Word | 7 | 05-07-2018 09:13 AM |
![]() |
Amitti | Word VBA | 2 | 04-10-2017 07:35 PM |
How to find all string within string. | PRA007 | Word VBA | 18 | 02-12-2016 08:11 PM |
![]() |
omahadivision | Excel Programming | 12 | 11-23-2013 12:10 PM |
![]() |
scarymovie | Word VBA | 5 | 05-16-2012 07:05 PM |