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
<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.
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:
176476
OFF: Office Assistant Not Answering Visual Basic Questions