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!

Hiding a single word document

Status
Not open for further replies.

JBU

Instructor
Nov 3, 2003
25
0
0
IN
Hi

I have a pretty complicated problem. I have a Word document with a table and some macros that can send the table information to another application. This is done by activating the Word document and hitting a shortcut. This works perfectly.
My problem is that I want the Word document to be as "invisble" as possible while I execute my macros by using the shortcuts. So far I resized the Word window displaying the document to its smallest possible size, and the using the windows Taskbar to activate it.
This however causes Word to open subsequent documents in this minimal (not minimized) size, and I don't want to resize all of these.

My approach so far has been using an EventClassModule so that this code is run when opening other word documents:

Public WithEvents appWord As Word.Application

Private Sub appWord_DocumentChange()
If ActiveWindow.Document.Name <> "NameOfSmallDocu.doc" Then
ActiveDocument.ActiveWindow.Width = 800
ActiveDocument.ActiveWindow.Height = 600
ActiveDocument.ActiveWindow.Left = 0
ActiveDocument.ActiveWindow.Top = 0
End If
End Sub

This automatically resizes all other documents, but this is not completely satisfactory. First of all it generates a debug error when closing the last open Word Document (since there no longer is a document with a name).

Is there anyone who can think of a different approach to hiding my document without influencing all other instances of Word?



Jens Busse
Workflow Consultant
CCI Europe A/S
 
Jens,

if your aim is to freeze the screen whilst the macro is running why not use [tt]Application.ScreenUpdating = False[/tt] at the start of your macro, and [tt]Application.ScreenUpdating = True[/tt] at the end of your macro

The macro will run without updating the screen; if you want users to view macro progress you can use [tt]Application.Statusbar = "Your Message"[/tt] to keep them informed

Alternatively, why not add the sizing/resizing code to the start/finish of your macro?

HTH

Cheers
Nikki
[bat] Look, mommy, I'm flying!
 
Well I've probably not explained my problem properly. I want this particular Word document to be available in the taskbar at all times (so I can run the macros attached to it) but I don't want it to be (too) visible on the screen. So far I've just resized it to the smallest possible size, but the result of this is that all other Word instances that are opened will have these miniature proportions when they are opened. Is there some way that I can access macros in a word document and still keeping it minimized in the taskbar?

Jens Busse
Workflow Consultant
CCI Europe A/S
 
You may consider converting your doc with macros to a global template (.dot) and put it in the AddIns collection.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Or you can use CreateObject to make a new instance of Word, open your macro file with that instance, but have that instance = invisible.

This works, but as PHV pointed out, if you are going to be consistently using this, use it as a global addin.



Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top