Set focus to application opened when using ShellExecute
Posted on 2008-11-14
I use the following line of code as part of a public sub routine to open various types of files from within Access:
iRet = ShellExecute(Forms("frmActivity").hWnd, "open", sDocFileNamePath, "", "", nCmdShow)
The code will open any file where the extension has been associated with a program, but the problem is as soon as the file opens, the form goes back to Access instead of the file that's been opened. nCmdShow is a numeric value that is supposed to set whether the program is opened minimized, maximized, etc, but it doesn't matter what numeric value I use here, the application still minimizes after opening.