

VbCritical, "An Error has Occurred!" End If Resume Error_Handler_Exit "Error Description: " & Err.Description, _ "Error Source: GetAppExePath" & vbCrLf & _ MsgBox "The following error has occurred." & vbCrLf & vbCrLf & _ If Err.Number = -2147024894 Then 'Cannot locate requested exe? Else On Error Resume Next Set WSHShell = Nothing Exit Function


GetAppExePath = WSHShell.RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\" & sExeName & "\") It may not be sold/resold or reposted on other sites (links ' back to this site are allowed). ' Website : ' Purpose : Determine the path for a given exe installed on the local computer ' Copyright : The following may be altered and reused as you wish so long as the ' copyright notice is left unchanged (including Author, Website and ' Copyright). On Error Resume Next Set oApp = Nothing Exit FunctionĮnd Function '- ' Procedure : GetAppExePath ' Author : Daniel Pineault, CARDA Consultants Inc. ' Website : ' Purpose : Determine is an App is running or not ' Copyright : The following may be altered and reused as you wish so long as the ' copyright notice is left unchanged (including Author, Website and ' Copyright). , vbOKOnly + vbCritical, "An Error has Occurred!" Resume Error_Handler_ExitĮnd Function '- ' Procedure : IsAppRunning ' Author : Daniel Pineault, CARDA Consultants Inc. "Error Description: " & Err.Description _ "Error Source: StartOutlook" & vbCrLf & _ "Error Number: " & Err.Number & vbCrLf & _ MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _ On Error Resume Next Set oOutlook = Nothing Exit Function OOutlookMsg.Display 'Show the message to the user Shell (sAPPPath) 'start outlook Do While Not IsAppRunning( "Outlook.Application")ĭoEvents Loop Set oOutlook = GetObject(, "Outlook.Application") 'Bind to existing instance of Outlook End If ' MsgBox "Outlook Should be running now, let's do something"ĭim oOutlookMsg As Object Set oOutlookMsg = oOutlook.CreateItem(olMailItem) 'Start a new e-mail message SAPPPath = GetAppExePath( "outlook.exe") 'determine outlook's installation path ' ' Usage: ' ~~~~~~ ' ' ' Revision History: ' Rev Date(yyyy/mm/dd) Description ' ************************************************************************************** ' 1 2014-Oct-31 Initial Release '- Function StartOutlook()ĭim oOutlook As Object Dim sAPPPath As String If IsAppRunning( "Outlook.Application") = True Then 'Outlook was already running Set oOutlook = GetObject(, "Outlook.Application") 'Bind to existing instance of Outlook Else 'Could not get instance of Outlook, so create a new one

' Website : ' Purpose : Demonstration of how one can start outlook if it isn't already started ' considering CreateObject("Outlook.Application") not longer works! ' Copyright : The following may be altered and reused as you wish so long as the ' copyright notice is left unchanged (including Author, Website and ' Copyright). '- ' Procedure : StartOutlook ' Author : Daniel Pineault, CARDA Consultants Inc.
