John said:
I have a userform with a textbox that allows people to "sign" the word
document. I also have several button, that when you click on them
change the background color of the button. This all works fine.
However, when the userform closes then reopens all the changes are
lost. Is there a way to enter information in a textbox or make other
changes and then make the changes perminent?
Thanks!
You can't make the changes "permanent" in the userform itself. What you can
do is store enough information in the document file to be able to restore
the state of the userform the next time it opens. The preferred way to do
that is to assign values to "document variables", which are strings that can
be written or changed only by a macro. A document variable is a named member
of the ActiveDocument.Variables collection. For more info, look up
"Variables Collection" in the VBA help.
The general idea is that you write code in the _Click procedure of the OK
button (whatever you named it) to store values in one or more document
variables at the same time that the userform's results are written to the
document's body. Then you write code in the Userform_Initialize procedure
(or maybe the Userform_Activate procedure) to try to read the document
variable values and, if they're present, set the userform's controls to the
corresponding settings. The first time the userform is used, there won't be
any values; after that, there will be.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.