Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
'possible values for the showCmd parameter in shellexecute
Private Const SW_HIDE = 0
Private Const SW_SHOWNORMAL =1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_MAXIMIZE = 3
Private Const SW_SHOWNOACTIVATE = 4
Private Const SW_SHOW = 5
Private Const SW_MINIMIZE = 6
Private Const SW_SHOWMINNOACTIVE = 7
Private Const SW_SHOWNA = 8
Private Const SW_RESTORE = 9
Private Const SW_SHOWDEFAULT = 10
'Return values of the shellexecute statement
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&
Private Const ERROR_BAD_FORMAT = 11&
Private Const SE_ERR_FNF = 2
Private Const SE_ERR_PNF = 3
Private Const SE_ERR_ACCESSDENIED = 5
Private Const SE_ERR_OOM = 8
Private Const SE_ERR_DLLNOTFOUND = 32
Private Const SE_ERR_SHARE = 26
Private Const SE_ERR_ASSOCINCOMPLETE = 27
Private Const SE_ERR_DDETIMEOUT = 28
Private Const SE_ERR_DDEFAIL = 29
Private Const SE_ERR_DDEBUSY = 30
Private Const SE_ERR_NOASSOC = 31
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Public Sub Launch(filePath As String, hwnd As Long, _
Optional showCmd As Long, Optional strOption As String, _
Optional strParam As String, Optional defaultDir As String)
Dim result As Long
Dim strResultMessage As String
strResultMessage = vbNullString
'if showcmd is not specified it is automatically set to the default application settings
If IsMissing(showCmd) Then
showCmd = SW_SHOWDEFAULT
End If
'if showCmd is not valid then it is set to the default application settings
If showCmd > 10 Or showCmd < 0 Then
showCmd = SW_SHOWDEFAULT
End If
If IsMissing(strOption) Or strOption = "" Then
strOption = "open"
End If
result = ShellExecute(hwnd, strOption, filePath, strParam, defaultDir, showCmd)
'check the results of the shellexecute statement
End Sub
dim file1
set file1 = CreateObject("LaunchWin.Launch")
file1.Launch Cstr(fileName), CLng(hwnd), CLng(showCmd), Cstr(strOption), Cstr(strParam), Cstr(defaultDir)