Microsoft KB Archive/188501

= OFF98: Shell Function May Not Set Focus Correctly. =

Article ID: 188501

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Excel 98 for Macintosh
 * Microsoft Word 98 for Macintosh
 * Microsoft PowerPoint 98 for Macintosh

-



This article was previously published under Q188501



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. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements. 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 :Desktop folder: where  is the name of you hard disk drive and 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.

