-2

so basically I have the bit of code that will execute an outlook email. That works fine and dandy however, for some of our machines outlook is installed but they are not allowed to set it up. So I have a work around function that is my error handling function.

When this code runs it starts to open outlook, but this is where I need it to test if it is set up and if it is - use it - if its not then bypass and execute the "goto workaround". here is the bit of code...

'NO OUTLOOK APP WORK AROUND
On Error GoTo WORKAROUND

'---> this is where i would need to test if outlook is set up and if not 
reference the GoTo function.

'Create Outlook email
Set xOutlookObj = CreateObject("Outlook.Application")
Set xEmailObj = xOutlookObj.CreateItem(0)
With xEmailObj
    .Display
    .To = ""
    .CC = ""
    .Subject = "QUOTE FOR -" + xSht.Name + xStr
    .Attachments.Add xFolder
    If DisplayEmail = False Then
        '.Send
    End If
End With
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Daniel Roy
  • 105
  • 8
  • Why do you ask a similar question [here](https://stackoverflow.com/questions/51795650/on-error-goto-if-no-error-how-to-skip) and never come back to it – Storax Aug 12 '18 at 07:15

1 Answers1

-1

It took some digging but i answered my own question. Using the getobjectfunction and on error goto workaround

Daniel Roy
  • 105
  • 8