OFF98: Shell Function May Not Set Focus Correctly.

ID: Q188501


The information in this article applies to:
  • Microsoft Excel 98 Macintosh Edition
  • Microsoft Word 98 Macintosh Edition
  • Microsoft PowerPoint 98 Macintosh Edition


SYMPTOMS

When you use the Shell function in one of the Microsoft Office 98 programs listed at the beginning of this article, the application may not receive focus or may be restored to its original size and position.


CAUSE

This problem may occur when the Shell function calls a program that is already open.


WORKAROUND

Microsoft provides programming examples 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 article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
To work around this behavior, use either of the following methods.

Method 1: ActivateMicrosoftApp method

If you are trying to set focus to a Microsoft application, modify the macro to use the ActivateMicrosoftApp method. If the application is already running, this method switches to the running application. If the application is not running, this method starts a new instance of the application.

   Application.ActivateMicrosoftApp xlMicrosoftWord 

Method 2: AppActivate method

If you are trying to set focus to a non-Microsoft application, modify the macro to use the AppActivate statement. The AppActivate statement changes the focus to the named application or window but does not affect if it is maximized or minimized. However, if the application is not running, this statement should be used in conjunction with the Shell function. For example, if the non-Microsoft application is SimpleText, the necessary code would be:

  Shell "pathname", 1      'This line is not necessary if the
                           'application already open.
  AppActivate "SimpleText" 
NOTE: Pathname is the path to the file or application. For example

   <Harddisk>:Desktop folder:<test> 
where <Harddisk> is the name of you hard disk drive and <test> is the name of the file you wish to set focus to.


STATUS

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article.


REFERENCES

For more information about the Shell function, from the Visual Basic Editor, click the Office Assistant, type "Shell", click Search, and then click to view "Shell Function".

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:

Q176476 OFF: Office Assistant Not Answering Visual Basic Questions

Additional query words: XL98 OFF98 PP98 WD98

Keywords : kbdta
Version : MACINTOSH:98
Platform : MACINTOSH
Issue type : kbbug


Last Reviewed: November 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.