Link to home
Start Free TrialLog in
Avatar of Clive Beaton
Clive BeatonFlag for Australia

asked on

How do I get a shelled program to appear on top of the Access window?

I use Shell "c:\WINDOWS\notepad.exe (etc) to display the contents of a file which works well, but appears behind the Access window.  How can I get it to display on top?

Thanks in advance.
Avatar of Máté Farkas
Máté Farkas
Flag of Hungary image

Use the vbNormalFocus option:
Shell "notepad.exe", vbNormalFocus 

Open in new window

Shell("c:\WINDOWS\notepad.exe", vbNormalFocus) - not maximized
Shell("c:\WINDOWS\notepad.exe", vbMaximizedFocus) - maximized
Avatar of Clive Beaton

ASKER

Thanks.  How do I create a line to include the path and file name, eg.  Application.CurrentProject.path\EventLog.txt
Application.CurrentProject.path & "\EventLog.txt"

Open in new window

You might need to use the AppActivate statement to make the notepad session active.  Hopefully, there is a distinct title bar caption for you to reference.
MacroShadow,

Can you please help me with this.  The following line of code doesn't find the file.

Shell "c:\WINDOWS\notepad.exe Application.CurrentProject.path & \EventLog.Txt", vbNormalFocus

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect.  Thank you very much.