A
Angyl
K. I have a Word2003 Template with bookmarked Form Fields.
By sample, one of the fields is named "ClientName"
There is a Userform (Named UserForm1) to go with this Form Template.
A Macro when you open the template for the first time, opens UserForm1.
UserForm1 contains all the same fields as the Template. When you press the
Command Button on the UserForm1 This code executes:
With ActiveDocument
.FormFields("ClientName").Result = ClientName
End With
ActiveDocument.Fields.Update
UserForm1.Hide
-----
Perfect, the UserForm puts the inputted data into the form and goes away.
NOW here's the problem.
If you save what you've done, and open it again, I've put in a Macro to open
the UserForm Again and repopulate the data from the Template into the
UserForm so you can make changes.
Sub autoopen()
'
' autoopen Macro
' Macro created 5/4/2006 by Timothy Allen
'
With UserForm1
UserForm1.ClientName.Text =
ActiveDocument.Bookmarks("ClientName").Range.Text
Great.
THE PROBLEM IS...that when you are done making changes and hit that command
button again to go back to the template EVERYTHING goes to Hell in the
document. I think it is re-inserting the data AGAIN, (rather than
overwriting it). The formulas get all messed up, calculating things, spaces
and weird numbers are inserted...
Any suggestions for fixing that?
By sample, one of the fields is named "ClientName"
There is a Userform (Named UserForm1) to go with this Form Template.
A Macro when you open the template for the first time, opens UserForm1.
UserForm1 contains all the same fields as the Template. When you press the
Command Button on the UserForm1 This code executes:
With ActiveDocument
.FormFields("ClientName").Result = ClientName
End With
ActiveDocument.Fields.Update
UserForm1.Hide
-----
Perfect, the UserForm puts the inputted data into the form and goes away.
NOW here's the problem.
If you save what you've done, and open it again, I've put in a Macro to open
the UserForm Again and repopulate the data from the Template into the
UserForm so you can make changes.
Sub autoopen()
'
' autoopen Macro
' Macro created 5/4/2006 by Timothy Allen
'
With UserForm1
UserForm1.ClientName.Text =
ActiveDocument.Bookmarks("ClientName").Range.Text
Great.
THE PROBLEM IS...that when you are done making changes and hit that command
button again to go back to the template EVERYTHING goes to Hell in the
document. I think it is re-inserting the data AGAIN, (rather than
overwriting it). The formulas get all messed up, calculating things, spaces
and weird numbers are inserted...
Any suggestions for fixing that?