Hi All,
I use the below code without issue on the machines at work to generate emails from vba and paste various bits from spreadsheets into them. All but two of the machines are using Excel/Outlook 2016 or later and the code runs no problem on them
2 of the machines were swapped out and replaced with ones running 2013 versions of both and the code now fails on the line " signature = newEmail.htmlBody"
Can anybody tell me why or point me in the direction of a solution
I use the below code without issue on the machines at work to generate emails from vba and paste various bits from spreadsheets into them. All but two of the machines are using Excel/Outlook 2016 or later and the code runs no problem on them
2 of the machines were swapped out and replaced with ones running 2013 versions of both and the code now fails on the line " signature = newEmail.htmlBody"
Can anybody tell me why or point me in the direction of a solution
VBA Code:
Dim Outlook As Object, newEmail As Object
Dim signature As String
Set Outlook = CreateObject("Outlook.Application")
Set newEmail = Outlook.CreateItem(0)
Who = 'takes names from the spreadsheet
Set newEmail = Outlook.CreateItem(0)
With newEmail
.display
signature = newEmail.htmlBody
.To = Who
.subject = ThisWorkbook.Name
.ReadReceiptRequested = False
Application.CutCopyMode = False
.Attachments.Add ThisWorkbook.FullName
End With
End Sub