Option Compare Database
Option Explicit


'---------------------------------------------------------------------------------------
' Module    : OpenApps
' Author    : Patrick Wood
' Purpose   : To open other common applications
'           : The Functions Seek to find the latest version and open it.
'           : *Requires DoesFileExist Function
'---------------------------------------------------------------------------------------

' Uncomment (Remove the ' ) the two lines of code below if they are not already at the top of your Module
'Option Compare Database
'Option Explicit

'------------------------------------------------------------
' OpenExcel
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenOutlook
'
'------------------------------------------------------------
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




'------------------------------------------------------------
' OpenWord
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OutlookAppointment
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OutlookNewContact
'
'------------------------------------------------------------
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



'---------------------------------------------------------------------------------------
' Procedure : OutlookNewEmail
' DateTime  : 4/12/2008 12:17
' Author    : Patrick Wood
' Purpose   : Opens a new blank Outlook Email to send
' Arguments : Requires DoesFileExist Function to determine
'             which version of Outlook exists
'---------------------------------------------------------------------------------------
'
Function OutlookNewEmail()
On Error GoTo ErrHandle

     'First we need to find which version of Outlook is on the computer.
     'We start looking for the latest version first.
     'Debug.Print will show the results in the immediate window.

    If DoesFileExist("C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE") = True Then
        Debug.Print "Office 14 Exists"
        ' Open a new Outlook Email to send
        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"
        ' Open a new Outlook Email to send
        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



'------------------------------------------------------------
' OpenMSPaint
'
'------------------------------------------------------------
Function OpenMSPaint()
On Error GoTo ErrHandle

    ' MSPaint
    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



'------------------------------------------------------------
' OutlookTask
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenInfopath
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenPublisher
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenPowerPoint
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' NewOutlookNote
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenCalculator
'
'------------------------------------------------------------
Function OpenCalculator()
    On Error GoTo OpenCalculator_Err

    ' Calculator
    Call Shell("C:\WINDOWS\system32\calc.exe", 1)

OpenCalculator_Exit:
    Exit Function

OpenCalculator_Err:
    MsgBox Error$
    Resume OpenCalculator_Exit

End Function



'------------------------------------------------------------
' OpenNotepad
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenWinExplorer
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenOneNote
'
'------------------------------------------------------------
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



'------------------------------------------------------------
' OpenIE
'
'------------------------------------------------------------
Function OpenIE()
On Error GoTo ErrHandle

    ' Internet Explorer

    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