Moving from one document to another

M

matthew.rodwell

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
 
D

Doug Robbins - Word MVP

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

--
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
 
M

matthew.rodwell

I still can't get this to work...i am unalbe to swap back to the
original template once the other is loaded
 
R

Russ

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
 

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