I've created a template that presents a user form. The form has a text field
that the user enters a filename. I use this filename and another variable to
construct the name that the document will be saved as.
I need to store the user-entered name in the saved document along with the
other variable so that if a user opens a previously saved document based on
this template, I can retrieve those variables.
How does one store a variable so that it will persist in the saved document
for later retrieval??
Thanks
Mike
--
Mike Starr WriteStarr Information Services
Technical Writer - Online Help Developer - Technical Illustrator
Graphic Designer - Desktop Publisher - MS Office Expert
(262) 694-1028 - mike@writestarr.com - http://www.writestarr.com
Helmut Weber - 26 Nov 2005 11:29 GMT
Hi Mike,
you may use a document variable,
like this:
Dim sVar As String
sVar = "testvar"
With ActiveDocument.Variables
.Item("MyName").Value = sVar
MsgBox .Item("MyName").Value ' testing
End With
Creates the variable, if doesn't exist,
and sets the value, otherwise, just sets the value.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
ML - 26 Nov 2005 11:30 GMT
Save it in a custom document property.
> I've created a template that presents a user form. The form has a text
> field that the user enters a filename. I use this filename and another
[quoted text clipped - 16 lines]
> Graphic Designer - Desktop Publisher - MS Office Expert
> (262) 694-1028 - mike@writestarr.com - http://www.writestarr.com
Mike Starr - 26 Nov 2005 19:10 GMT
Thanks to both Helmut and ML... you've pointed me in the right direction.
Now that I know what to look for, I've found the appropriate topics in the
VBA help file.
Mike
> I've created a template that presents a user form. The form has a text
> field that the user enters a filename. I use this filename and another
[quoted text clipped - 16 lines]
> Graphic Designer - Desktop Publisher - MS Office Expert
> (262) 694-1028 - mike@writestarr.com - http://www.writestarr.com