|
-
May 30th, 2006, 03:21 PM
#1
Thread Starter
New Member
[RESOLVED] Persistent document variables VBA word
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????
Last edited by Hack; May 31st, 2006 at 06:58 AM.
Reason: Added [RESOLVED] to thread title Last edited by gkukurin : Yesterday at 05:19 PM. Reason: Resloved
-
May 30th, 2006, 03:42 PM
#2
Re: Persistent document variables VBA word
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?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
May 30th, 2006, 03:42 PM
#3
Re: Persistent document variables VBA word
G'Day gkukurin, Welcome to the Forum 
How have you set the variable? Can you post the code you used (if you did it in code)?
-
May 30th, 2006, 04:11 PM
#4
Thread Starter
New Member
Re: Persistent document variables VBA word
'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
-
May 30th, 2006, 04:18 PM
#5
Thread Starter
New Member
Re: Persistent document variables VBA word
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
-
May 30th, 2006, 04:39 PM
#6
Re: Persistent document variables VBA word
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
-
May 30th, 2006, 04:50 PM
#7
Thread Starter
New Member
Re: Persistent document variables VBA word
-
May 30th, 2006, 10:32 PM
#8
Re: Persistent document variables VBA word
Yeah Burce... thats where I was headed... if there was a variables collection (object) then u could loop through
Glad it worked!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|