Microsoft KB Archive/132093

PRJ4: Setting Visible Property True Won’t Activate Only Window

PSS ID Number: Q132093 Article last modified on 08-24-1995

4.00 | 4.00

WINDOWS | MACINTOSH

= SYMPTOMS =

Using a macro to set the Visible property to True on a sole hidden project window displays the window. However, the window fails to activate and may allow any of the following conditions to occur:

An inappropriate menu bar may be displayed.

-or-

Some menu items that should be enabled may be disabled.

-or-

Some macro commands that require an active window may fail.

= STATUS =

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

= WORKAROUND =

Microsoft provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided ‘as is’ and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. Note that a line that is preceded by an apostrophe introduces a comment in the code–comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line- continuation character.

After making a window visible, use the following line in your macro code:

ActiveWindow.Activate This method assures that Microsoft Project fully activates the window

A macro example that makes a lone hidden project visible and then makes it active is the following:

Sub Visible4 Projects(&quot;Project1&quot;).Windows(1).Visible = True ActiveWindow.Activate End Sub Note that if “Project1” is the only open window, then it will be active after the macro runs. But if another project, “Project2,” is active before running the macro, then “Project2” will still be active after the macro runs.

= MORE INFORMATION =

If the purpose of a macro is to make a project both visible and active, regardless of what project is initially active, then the WindowUnhide method should be used instead of setting the Visible property to True. For example,

WindowUnhide &quot;Project1&quot; This makes “Project1” visible and activates it.

KBCategory: kbprg kbcode buglist4.00 KBSubcategory: projwin projmac

Additional reference words: 4.00

=
================================================================ Copyright Microsoft Corporation 1995.