sdohertyccb
Board Regular
- Joined
- Feb 15, 2005
- Messages
- 91
I have code that sends an email through VBA code in excel. I want to test to see if Outlook is open (not everone will be using this on their primary email box) and if not, to open then send the attachments.
I have simpliefied the code below, would appreciate it if someone can give me the additional code to open this application.
When I run the following code on a box that does not have Oulook open, I get into some kind of a loop with a message that pops up that says "Excel is waiting for another OLE application to finish", which it never does...
Thoughts?
Thanks so much, in advance.
I have simpliefied the code below, would appreciate it if someone can give me the additional code to open this application.
When I run the following code on a box that does not have Oulook open, I get into some kind of a loop with a message that pops up that says "Excel is waiting for another OLE application to finish", which it never does...
Thoughts?
Thanks so much, in advance.
Code:
Sub send_test()
Dim Outlook_App As Object
Dim Outlook_Mail As Object
Set Outlook_App = CreateObject("Outlook.Application")
Set Outlook_Mail = Outlook_App.CreateItem(0)
On Error Resume Next
With Outlook_Mail
.To = "me@xxxx.com"
.Subject = "Test Email"
.Body = "Help me!"
.Send
End With
On Error GoTo 0
Set Outlook_Mail = Nothing
Set Outlook_App = Nothing
End Sub