Populating userform/sharing data

H

Hector

I have two templates, each with their own userforms and they work just fine.

Under certain conditions (a checkbox in userform1 = True) a new document
based on template2 is created. Again this is working fine.

The two documents/templates share a couple of pieces of info and the problem
I'm having is populating userform2 with the relevant info from userform1.

At the moment a command button on userform1 has the code to populate the
bookmarks in template1. The code to test the creation of document2 is in the
terminate event of userform1.

The two templates must also remain separate, in that a new document can be
created from template2 without anything to populate from template1.

I hope that makes some sense! Any pointers will be gratefully appreciated.

h.
 
D

Doug Robbins - Word MVP

I think that what I would do is use the System.PrivateProfileString command
to write the information from the Template 1 UserForm to a .txt file and
then in the Initialize event for the Template 2 UserForm, use the same
command to extract the information from the .txt file and populate the
relevant controls on that form.

In a command button click event, you would want to delete the information
from the .txt file (once again using the System.PrivateProfileString
command) so that the controls on Template 2 UserForm were not populated with
extraneous data if a document was created directly from Template 2 in the
absence of Template 1.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top