wes mcallister
New Member
- Joined
- May 19, 2011
- Messages
- 4
I have a macro that sends an email. This works fine in both 2003 and 2007 when outlook is not running. But in 2010 it does not work. Any thoughts or fixes.
Sub mail_text()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim Req As String
Dim qty1 As String
strbody = "Hi Wes" & vbNewLine & vbNewLine & _
"I have created a new Requisition" & vbNewLine & _
"The Request # is " & Range("L2")
Set OutApp = CreateObject("Outlook.Application")
'Set OutApp = GetObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.Subject = "New Request # " & Range("L2")
.To = ""
'.CC = ""
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = strbody
.Display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Sub mail_text()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim Req As String
Dim qty1 As String
strbody = "Hi Wes" & vbNewLine & vbNewLine & _
"I have created a new Requisition" & vbNewLine & _
"The Request # is " & Range("L2")
Set OutApp = CreateObject("Outlook.Application")
'Set OutApp = GetObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.Subject = "New Request # " & Range("L2")
.To = ""
'.CC = ""
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = strbody
.Display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub