zahir4job
04-05-2012, 01:27 AM
I have four bookmarks and many fields are referenced to these bookmarks I want to update the text of the bookamrks each time I run the macro and eventually all the fields referring to the bookmarks should be updated with the new value I tried many ways to update the bookmark text and update the fields but the fields are getting updated only once with a new document later on its not reflecting. following is the code i used. Please help I am new to macro coding. Thanks in advance.
Dim bmRange As Range
Set bmRange = ActiveDocument.Bookmarks("BankNameCover").Range
bmRange.Text = "Value1"
ActiveDocument.Bookmarks.Add _
Name:="BankNameCover", _
Range:=bmRange
Set bmRange = Nothing ' Repeat this three more times for other three bookmarks
For Each myField In ActiveDocument.Fields
myField.Update
'myField.Locked = True
Next myField
Please help thanks in advance.
Dim bmRange As Range
Set bmRange = ActiveDocument.Bookmarks("BankNameCover").Range
bmRange.Text = "Value1"
ActiveDocument.Bookmarks.Add _
Name:="BankNameCover", _
Range:=bmRange
Set bmRange = Nothing ' Repeat this three more times for other three bookmarks
For Each myField In ActiveDocument.Fields
myField.Update
'myField.Locked = True
Next myField
Please help thanks in advance.