Hello all,
I have some code that would send an email for me. But after having Outlook updated or reinstalled, now it no longer works on this particular computer (though this code does work on another computer).
The red is what gets highlighted. My online Research suggested adding Microsoft Scripting Runtime to the VBA references, but that did not help either. I've tried to look through outlook to see what the issue is, but my account looks just the same as it did before.
I'm not sure if other people have encountered this, or if they know of any creative solutions to get this to function again, but any help would be greatly appreciated.
I have some code that would send an email for me. But after having Outlook updated or reinstalled, now it no longer works on this particular computer (though this code does work on another computer).
VBA Code:
Sub DQ_Comp()
[COLOR=rgb(184, 49, 47)][B]Dim OutApp As Outlook.Application[/B][/COLOR], OutMail As Outlook.MailItem, OutAccount As Outlook.Account, strbody As String
Set OutApp = CreateObject("Outlook.Application"): Set OutMail = OutApp.CreateItem(olMailItem)
'specify which email account
Set OutAccount = OutApp.Session.Accounts.Item("anichols@somewhere.com")
strbody = "Test Email" & vbNewLine & _
"Drew Nichols"
On Error Resume Next
With OutMail
.To = "anichols@somewhere.com"
.Subject = "Delinquency Report Complete"
.Importance = 2
.Body = strbody
.SendUsingAccount = OutAccount
'.Attachments.Add Sheets(1).Range("B38").Value '41
.Send
End With
On Error GoTo 0: Set OutMail = Nothing: Set OutApp = Nothing: Set OutAccount = Nothing
End Sub
I'm not sure if other people have encountered this, or if they know of any creative solutions to get this to function again, but any help would be greatly appreciated.