Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Documents in Word (VBA)

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
0
0
GB
Hi, I have 4 Documents, Doc1, Doc2, Doc3, Doc4.

In Word (2000) I start by having Doc1 opened, there is a button on Doc1 that then opens Doc2, and the user goes back and forth between documents. Doc1 is the last to be activated and i.e the user finishes back at Doc1. Doc1 then opens Doc3. Doc1 and Doc2 can then be seen as buttons on the bottom toolbar. Then from Doc3 Doc 4 is opened, but does not show in Word instead it is shown on the bottom toolbar and Doc 3 is displayed which I don't want.

So I have all of these documents open, or are they open when they are sitting on the bottom toolbar area.

How do I shut these document down. when I open Doc3, I want Doc1 and Doc2 to shut down. When I open Doc4 I want Doc3 to shut down.

I have already used the following code:

Documents("Doc1.doc").Close
Documents("Doc2.doc").Close

But the system only shuts down Doc1.?.

Are you confused yet?. I am!

p.s(Doc3 opens and loads a userForm this is probably why it is displqyed in Word and not shown on the toolbar, like Doc4. I really need the last document to opened and displayed to the user not sitting on the toolbar at the bottom of the screen.)



 
I am not sure that I am following the steps that you are taking, but it sounds like you have seperate application objects for each document that you open, or you would only have one instance of Microsoft Word on the "bottom toolbar".
You need to either define seperate application objects for each document as you open them, or ensure that all documents are opened within the orignal application.

Hopefully this points you in the right direction
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top