Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2007

Tip: Looking for answers? Try searching our database.

Populating userform/sharing data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hector - 20 Nov 2007 09:25 GMT
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.
Doug Robbins - Word MVP - 20 Nov 2007 09:47 GMT
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.

Signature

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

>I have two templates, each with their own userforms and they work just
>fine.
[quoted text clipped - 17 lines]
>
> h.
Hector - 20 Nov 2007 10:46 GMT
An elegant solution Doug - wish I'd thought of it myself! :-)

Thankyou!

h.

> 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
[quoted text clipped - 29 lines]
> >
> > h.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.