Hi All,
Hoping someone out there will be able solve this one for me.
Majority of our machines at work run 2016 or newer but for some reason our office acquired a few that have 2010 installed. We use excel to automate email sending a lot and the below code works perfectly on all of the machines except the 2010 ones.
On the 2010 machines it will fail in 2 places.
the first place is at
having googled a lot on this I believe it is possibly due to the security levels in 2010 and effectively no work around - can manage without this but please correct me if I am wrong.
the second place it fails is at
and here it gives a runtime error of 287 - but only on the 2010 machines. Been trying to research around the possibility of late binding but not even sure Im starting in the right place.
Could somone help me out.
Hoping someone out there will be able solve this one for me.
Majority of our machines at work run 2016 or newer but for some reason our office acquired a few that have 2010 installed. We use excel to automate email sending a lot and the below code works perfectly on all of the machines except the 2010 ones.
VBA Code:
Dim Outlook As Object, newEmail As Object, xInspect As Object, pageEditor As Object
Set Outlook = CreateObject("Outlook.Application")
Set newEmail = Outlook.createitem(0)
With newEmail
.SentOnBehalfOfName = "Company Email Goes Here"
.display
signature = newEmail.htmlbody
.To = MyList ' this is defined in the larger code as the distribution list
.Bcc = "The Boss Email Address"
.subject = "My Subject Goes Here - "
.htmlbody = "EMAIL TEXT IS HERE"
.ReadReceiptRequested = False
Set xInspect = newEmail.GetInspector
Set pageEditor = xInspect.WordEditor
pageEditor.Application.Selection.Start = Len(.htmlbody)
pageEditor.Application.Selection.End = pageEditor.Application.Selection.Start
pageEditor.Application.Selection.pasteandformat (wdformatplaintext)
.display
.htmlbody = .htmlbody & signature
Set pageEditor = Nothing
Set xInspect = Nothing
Application.CutCopyMode = False
End With
On the 2010 machines it will fail in 2 places.
the first place is at
VBA Code:
signature = newEmail.htmlbody
the second place it fails is at
VBA Code:
Set xInspect = newEmail.GetInspector
Set pageEditor = xInspect.WordEditor
Could somone help me out.