Option Compare Database
Option Explicit
Function OpenExcel()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\EXCEL.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\EXCEL.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\EXCEL.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\EXCEL.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\EXCEL.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\EXCEL.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\EXCEL.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\EXCEL.EXE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenExcel in Module modtemp"
Resume ExitHere
End Function
Function OpenOutlook()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenOutlook in Module modtemp"
Resume ExitHere
End Function
Function OpenWord()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\OFFICE14\WINWORD.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\WINWORD.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\WINWORD.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\WINWORD.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\WINWORD.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\WINWORD.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\WINWORD.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\WINWORD.EXE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenWord in Module modtemp"
Resume ExitHere
End Function
Function OutlookAppointment()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\OFFICE14\OUTLOOK.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE /c IPM.APPOINTMENT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE /c IPM.APPOINTMENT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /c IPM.APPOINTMENT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE /c IPM.APPOINTMENT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE /c IPM.APPOINTMENT", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OutlookAppointment in Module modtemp"
Resume ExitHere
End Function
Function OutlookNewContact()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE /c IPM.CONTACT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE /c IPM.CONTACT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /c IPM.CONTACT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE /c IPM.CONTACT", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE /c IPM.CONTACT", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OutlookNewContact in Module modtemp"
Resume ExitHere
End Function
Function OutlookNewEmail()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE /c IPM.NOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE /c IPM.NOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /c IPM.NOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE /c IPM.NOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE /c IPM.NOTE", 1)
Else
Call MsgBox("The Program you tried to open" & _
" was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OutlookNewEmail in Module modtemp"
Resume ExitHere
End Function
Function OpenMSPaint()
On Error GoTo ErrHandle
Call Shell("C:\WINDOWS\system32\mspaint.exe", 1)
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenMSPaint in Module modtemp"
Resume ExitHere
End Function
Function OutlookTask()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE /c IPM.TASK", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE /c IPM.TASK", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /c IPM.TASK", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE /c IPM.TASK", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE /c IPM.TASK", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OutlookTask in Module modtemp"
Resume ExitHere
End Function
Function OpenInfopath()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\INFOPATH.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\INFOPATH.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\INFOPATH.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\INFOPATH.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\INFOPATH.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\INFOPATH.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\INFOPATH.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\INFOPATH.EXE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenInfopath in Module modtemp"
Resume ExitHere
End Function
Function OpenPublisher()
On Error GoTo OpenPublisher_Err
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\MSPUB.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\MSPUB.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\MSPUB.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\MSPUB.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\MSPUB.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSPUB.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\MSPUB.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\MSPUB.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\MSPUB.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\MSPUB.EXE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
OpenPublisher_Exit:
Exit Function
OpenPublisher_Err:
MsgBox Error$
Resume OpenPublisher_Exit
End Function
Function OpenPowerPoint()
On Error GoTo OpenPowerPoint_Err
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\POWERPNT.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\POWERPNT.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\POWERPNT.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\POWERPNT.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\POWERPNT.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\POWERPNT.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\POWERPNT.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\POWERPNT.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\POWERPNT.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\POWERPNT.EXE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
OpenPowerPoint_Exit:
Exit Function
OpenPowerPoint_Err:
MsgBox Error$
Resume OpenPowerPoint_Exit
End Function
Function NewOutlookNote()
On Error GoTo NewOutlookNote_Err
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE /c IPM.STICKYNOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE /c IPM.STICKYNOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /c IPM.STICKYNOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\OUTLOOK.EXE /c IPM.STICKYNOTE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\OUTLOOK.EXE /c IPM.STICKYNOTE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
NewOutlookNote_Exit:
Exit Function
NewOutlookNote_Err:
MsgBox Error$
Resume NewOutlookNote_Exit
End Function
Function OpenCalculator()
On Error GoTo OpenCalculator_Err
Call Shell("C:\WINDOWS\system32\calc.exe", 1)
OpenCalculator_Exit:
Exit Function
OpenCalculator_Err:
MsgBox Error$
Resume OpenCalculator_Exit
End Function
Function OpenNotepad()
On Error GoTo ErrHandle
Call Shell("C:\WINDOWS\system32\notepad.exe", 1)
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenNotepad in Module modtemp"
Resume ExitHere
End Function
Function OpenWinExplorer()
On Error GoTo ErrHandle
Call Shell("C:\WINDOWS\explorer", 1)
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenWinExplorer in Module modtemp"
Resume ExitHere
End Function
Function OpenOneNote()
On Error GoTo ErrHandle
If DoesFileExist("C:\Program Files\Microsoft Office\Office14\ONENOTE.EXE") = True Then
Debug.Print "Office 14 Exists"
Call Shell("C:\Program Files\Microsoft Office\Office14\ONENOTE.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE12\ONENOTE.EXE") = True Then
Debug.Print "Office 12 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE12\ONENOTE.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE11\ONENOTE.EXE") = True Then
Debug.Print "Office 11 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\ONENOTE.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE10\ONENOTE.EXE") = True Then
Debug.Print "Office 10 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE10\ONENOTE.EXE", 1)
ElseIf DoesFileExist("C:\Program Files\Microsoft Office\OFFICE9\ONENOTE.EXE") = True Then
Debug.Print "Office 9 Exists"
Call Shell("C:\Program Files\Microsoft Office\OFFICE9\ONENOTE.EXE", 1)
Else
Call MsgBox("The Program you tried to open was not found. ", _
vbCritical, " Program Not Found")
Debug.Print "Program File Not Found"
End If
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenOneNote in Module modtemp"
Resume ExitHere
End Function
Function OpenIE()
On Error GoTo ErrHandle
Call Shell("C:\Program Files\Internet Explorer\iexplore.exe", 1)
ExitHere:
Exit Function
ErrHandle:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description _
& vbCrLf & "In procedure OpenIE in Module modtemp"
Resume ExitHere
End Function