Open a file or program
' API function declaration
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "Shellexecutea" (ByVal hWnd as Long, ByVal lpoperation as Str ING, ByVal lpfile As String, ByVal lpparameters as String, ByVal lpdirectory as String, ByVal nShowCmd as long) as long
' ShellExecute function two times package to simplify use
' Input parameter file can be a file name, Web address or command line
Public Function ShellEx (File as String)
ShellExecute hWndAccessApp, "Open", File, 0, 0, 1
End Function
Use the hWndAccessApp method to determine the handle that Microsoft Windows assigns to the Microsoft Access main window.
Expression.hwndaccessapp
expression Required. Returns an expression for an object in the "Applies to" list.
Description
The hWndAccessApp method returns a read-only long Integer value set by Microsoft Access.
You can use this method with visual Basic when you call Windows Application Programming Interface (API) functions or other external procedures that require window handles as parameters.
To get a handle to a window with a Microsoft Access object such as form or report, you can use the HWND property.
Knowledge learned from Access-VBA development (III.)