![]() |
#1
|
|||
|
|||
![]()
Hello all,
I'm new to the whole VBA in word, and am struggling to resolve this issue!!! What I am trying to achieve is to have a doc with various bookmarks, when a script is run, vba systematically goes through all bookmarks, requests user input via an inputbox, and then replaces the text with the user determined text. This is what I have so far; Code:
Sub UpdateBookmarks() Dim bmInput As String For Each bm In ActiveDocument.Bookmarks bmInput = InputBox("Please enter " & bm.Name) UpdateBM ActiveDocument, bm.Name, bmInput Next End Sub Sub UpdateBM(ByRef bmDoc As Document, bmName As String, bmContent As String) Dim bmRng As Word.Range Set bmRng = bmDoc.Bookmarks(bmName).Range bmRng.Text = bmContent End Sub Please can anyone help?? Many thanks all |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
CCITE140 | Excel | 1 | 11-30-2015 07:42 AM |
Replacing the 2nd or 3rd instance of Text | wdillon2 | Word VBA | 2 | 05-13-2015 10:21 PM |
![]() |
piritzo | Word | 2 | 06-22-2013 12:50 AM |
![]() |
sbatson5 | Word | 2 | 04-13-2012 03:49 AM |
Replacing / editting text | LisaC | Word | 0 | 02-25-2010 03:40 AM |