Charles
Tue May 31 18:09:54 CDT 2005
Store the information in your document/template as document variables and
save. When userform is used again, have it check for existence of variables
and if present, use those values.
--
Charles Kenyon
Word New User FAQ & Web Directory:
http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
http://addbalance.com/usersguide
See also the MVP FAQ:
http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
"axeman" <axeman@discussions.microsoft.com> wrote in message
news:19DE1299-50C4-45C2-BA9C-A217514854CB@microsoft.com...
> How would this work for a userform that I want to restores the values of
> the
> fields every time that the application is run. Basically, the user inputs
> the
> information and closes out of the application once they are finished with
> their processing. Then the next time that they run the app the information
> they typed in last is automcatically populated in all the fields.
>
> Thanks,
> Axe
>
> "Dawn Crosier" wrote:
>
>> I would store the information in Document Variables if you want the
>> data available for repeat running.
>>
>> Here is some sample code which will check to see whether a variable
>> exists, if not it will help you to create one, and add a value to it.
>>
>> 'Test to see whether document variables exist if not add then
>>
>> If DocVarExists("varClientName") Then
>>
>> ActiveDocument.Variables("varClientName").Value = "test"
>>
>> Else
>>
>> ActiveDocument.Variables.Add Name:="varClientName",
>> Value:="test"
>>
>> End If
>>
>>
>>
>> 'Function used to check to make sure the Document Variable exists
>> because
>>
>> 'If you try to add it, and it does not exist - an error will be
>> returned.
>>
>> 'Same is true if you try to set its value and it does not exist.
>>
>> Function DocVarExists(strVarName As String) As Boolean
>>
>> Dim varDocVars As Variant
>>
>>
>>
>> DocVarExists = False
>>
>> For Each varDocVars In ActiveDocument.Variables
>>
>> If varDocVars.Name = strVarName Then DocVarExists = True
>>
>> Next varDocVars
>>
>>
>>
>> End Function
>>
>>
>>
>> To retrieve a Document Variable for use
>>
>> = ActiveDocument.Variables("varVersion").Value
>>
>>
>>
>> To update a Bookmark based on a result from code
>>
>> ActiveDocument.Bookmarks("DateOfLetter").Range = _
>>
>> ActiveDocument.Variables("varVersion").Value
>>
>>
>>
>> I hope this helps.
>>
>>
>> --
>> Dawn Crosier
>> Microsoft MVP
>> "Education Lasts a Lifetime"
>>
>> This message is posted to a newsgroup. Please post replies and
>> questions to the newsgroup so that others can learn as well.
>>
>> "axeman" <axeman@discussions.microsoft.com> wrote in message
>> news:D2AA7C50-0092-44E9-89BD-2FFEECA23C85@microsoft.com...
>> > Is there any way to save the user input so that next time a user
>> > runs the app
>> > it pops up with the information they entered last time in all the
>> > fields???
>> >
>> > Thanks,
>> > Axe
>>
>>