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 / October 2007

Tip: Looking for answers? Try searching our database.

Moving from one document to another

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
matthew.rodwell@luptonfawcett.com - 26 Oct 2007 11:20 GMT
Hey there, i have a problem where i have one template opening another
so they share the same data only when its finished i want it to go
back to the first document and not stay on the second newly loaded.
any ideas of the code for this..Baring in mind the document names will
not always be the same

thanks in advance

Matthew
Doug Robbins - Word MVP - 26 Oct 2007 23:15 GMT
Declare variables to hold the documents.

In code in the first template

Dim Doc1 and Document, Doc2 as Document

Set Doc1 = ActiveDocument

then, create the second document by using

Set Doc2 = Documents.Add("Name of Template for second document")

Then refer to the documents as Doc1 and Doc2

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

> Hey there, i have a problem where i have one template opening another
> so they share the same data only when its finished i want it to go
[quoted text clipped - 5 lines]
>
> Matthew
matthew.rodwell@luptonfawcett.com - 29 Oct 2007 17:35 GMT
I still can't get this to work...i am unalbe to swap back to the
original template once the other is loaded
Russ - 29 Oct 2007 18:52 GMT
Matthew,
What do you mean by template?
A Word template is a .dot file.
A regular document is a .doc file.
Word documents can also be forms with form fields for user input.
Userforms are not those kind of forms but are like popup dialog forms for
user interaction, whose data then get injected into documents via code.
Doug's method should work with documents. At the end of his code; to go back
to the original active document, you now refer to it as Doc1 and use
Doc1.Activate

> I still can't get this to work...i am unalbe to swap back to the
> original template once the other is loaded
[quoted text clipped - 22 lines]
>>>
>>> Matthew

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID


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.