![]() |
|
#1
|
|||
|
|||
|
I have some field in a document, like:
{ MyName } How to set MyName value with vba? When I was using { DOCVARIABLE MyName } I did that so simple with activedocument.variables("MyName")="Hello". Thanks |
|
#2
|
||||
|
||||
|
If that field is working then you must have a bookmark in the document of the same name
Code:
Sub ResetBookmark()
Dim sBkmk As String, aRng As Range
sBkmk = "MyName"
If ActiveDocument.Bookmarks.Exists(sBkmk) Then
Set aRng = ActiveDocument.Bookmarks(sBkmk).Range
aRng.Text = "Hello from the other side"
ActiveDocument.Bookmarks.Add Name:=sBkmk, Range:=aRng
End If
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#3
|
|||
|
|||
|
Thank you! I'm going to stick with DOCVARIABLE as it's a bit simpler to manage within VBA.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Field not show result
|
eduzs | Word | 9 | 06-02-2019 03:48 PM |
One Cell that controlls spread sheet result button to change simple fomula result
|
RAH | Excel Programming | 5 | 03-31-2018 04:52 PM |
Result Calculator
|
Raza | Excel Programming | 7 | 01-26-2015 11:35 PM |
| result of merge field is incorrect | VHV | Mail Merge | 3 | 06-16-2014 03:46 PM |
Form field calculation returning 2x correct result
|
Jschueller | Word | 1 | 08-20-2013 01:51 PM |