The key point is to write a procedure in the UserForm's code, specifically
naming the procedure UserForm_Initialize(). (You can quickly get the Sub and
End Sub lines for this by choosing UserForm in the left-hand dropdown at the
top of the code window, and then choosing Initialize from the right-hand
dropdown.) This procedure runs when your UserForm is first created in
memory, and before it appears on the screen. In the procedure, you need code
to get the existing values (or as many of them as do exist, recognizing that
none of them will exist in a new document) and put them into the UserForm's
controls.
In addition to the AutoNew or Document_New macro that shows the UserForm
when a new document is being created, you'll need an AutoOpen or
Document_Open macro that shows the UserForm when an existing document is
re-opened. It can probably just repeat the same code from the AutoNew macro,
although that isn't necessarily true.
Although you can extract the values from the bookmarks in your current
template, you might find it worthwhile to change the setup a bit. Word
supports things called "document variables", which are named strings that
are stored invisibly within the document (they're part of the file that's
saved to disk) and which can be created and read by macros and UserForms.
They're much more robust than bookmarks, since users have no access to them.
Your UserForm's OK_Click procedure can store the values from the user's
entries in document variables, and the UserForm_Initialize procedure can
read those values. Then instead of bookmarks, the document body can contain
DocVariable fields that display the values. Even if a user deletes one of
these fields (and they're harder to delete unintentionally than are
bookmarks), the data won't be lost, and the document can be repaired just by
inserting a new field. Look in the main help for the topic on DocVariable
fields, and in the VBA help for the topic on the Variables collection.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.