I'm setting a document variable in msWord.
I can set it.
Delete it.
Reset it.
Read the value of it.
But I don't know how to tell if it already exists????
Printable View
I'm setting a document variable in msWord.
I can set it.
Delete it.
Reset it.
Read the value of it.
But I don't know how to tell if it already exists????
http://www.vbforums.com/
this goes in the Office Development
Word is the only Office app I have little exp with programming..
is there a "variable" object?
like ThisDocument.Variable.Count?
G'Day gkukurin, Welcome to the Forum :wave:
How have you set the variable? Can you post the code you used (if you did it in code)?
'This code creates a doc_var called <Fullname>
'And sets the doc_var value to the value of a textbox
Private Sub CommandButton5_Click()
ActiveDocument.Variables.Add Name:="FULLNAME", Value:= txtINDI.Text
End Sub
Static...
You're right on!!!
Yes I can obtain a count and this in turn gives me the info I need to
determine how many, if any variables exist.
Thanks!!!!
GK
As an alternative to .Count, you could use the Variables Collection like:
VB Code:
Dim objVar As Variable For Each objVar In ActiveDocument.Variables MsgBox "Name =" & objVar.Name & vbCr & "Value = " & objVar.Value Next
Thanks All!!!
Yeah Burce... thats where I was headed... if there was a variables collection (object) then u could loop through
Glad it worked!