![]() |
|
|
Thread Tools | Display Modes |
#4
|
||||
|
||||
![]()
All you need do, then, is add bookmark to the “process document” in front of one telephone number, and cross-references to that bookmark in front of the rest of the telephone numbers, then update the bookmark with the country code, followed by .Fields.Update. However, there is an issue with the way your code currently 'updates' bookmarks. Instead of updating them, it merely inserts text after them. To update a bookmark you should use code like:
Code:
Sub UpdateBookmark(StrBkMk As String, StrTxt As String) Dim BkMkRng As Range With ActiveDocument If .Bookmarks.Exists(StrBkMk) Then Set BkMkRng = .Bookmarks(StrBkMk).Range BkMkRng.Text = StrTxt .Bookmarks.Add StrBkMk, BkMkRng End If End With Set BkMkRng = Nothing End Sub Call UpdateBookmark("Address1", vbCrLf & ComboBox1) Similarly, for adding & updating your “process document”, you might use code like: Code:
Documents.Add Template:="File Path\Process Document.dot", NewTemplate:=False If ComboBox1 <> "UK" Then Call UpdateBookmark("IDC", "+44 ") ActiveDocument.Fields.Update End If
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
lukael | Excel Programming | 5 | 02-18-2014 05:20 AM |
Userform Code not quite right - help please | vbanovice | Word VBA | 1 | 09-29-2013 09:20 PM |
![]() |
AlexR | Word VBA | 7 | 03-31-2013 12:17 PM |
![]() |
SaneMan | Word VBA | 5 | 10-14-2011 05:12 AM |
![]() |
SaneMan | Word VBA | 5 | 04-01-2011 03:11 PM |