Re: Populating userform/sharing data by Doug
Doug
Tue Nov 20 01:47:27 PST 2007
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
"Hector" <Hector@discussions.microsoft.com> wrote in message
news:2FFBF0B7-9546-40E0-8C0D-CFD72C743017@microsoft.com...
>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.