Treebys
Member
- Outlook version
- Email Account
- Exchange Server
Hi, I hope someone can help. I have an Access 2003 database that has a Sub using VBA to create an email in the background, attach documents and then when ready display (or should). This has always worked fine until Office 2016. It seems to run the entire code ok until it hits .display as which point I get an 'Array Out of Bounds' error. The syntax appears to be correct and as I have said it worked on previous office version including 2015. The Sub creates an email . It's a lengthy bit of code but here is the section in question:
Set OLNS = objOutlook.GetNamespace("MAPI")
Set MailFolder = OLNS.GetDefaultFolder(olFolderDrafts)
objOutlook.ActiveWindow
Set MailFolder = OLNS.GetDefaultFolder(olFolderDrafts)
MailFolder.Display
Set objEmail = MailFolder.Items.Add
With objEmail
.To = strTo
.CC = strCc
.Subject = strSubject
.HTMLBody = strBody
objEmail.Attachments.Add strReportSummary
If blnDec = True Then
objEmail.Attachments.Add strDec
End If
objEmail.Attachments.Add CurrentProject.path & "\" & "KeyFacts.pdf"
objEmail.Attachments.Add CurrentProject.path & "\" & "Client Agreement.pdf"
.Display
End With
Any help/ideas appreciated. Thanks in advance.
Set OLNS = objOutlook.GetNamespace("MAPI")
Set MailFolder = OLNS.GetDefaultFolder(olFolderDrafts)
objOutlook.ActiveWindow
Set MailFolder = OLNS.GetDefaultFolder(olFolderDrafts)
MailFolder.Display
Set objEmail = MailFolder.Items.Add
With objEmail
.To = strTo
.CC = strCc
.Subject = strSubject
.HTMLBody = strBody
objEmail.Attachments.Add strReportSummary
If blnDec = True Then
objEmail.Attachments.Add strDec
End If
objEmail.Attachments.Add CurrentProject.path & "\" & "KeyFacts.pdf"
objEmail.Attachments.Add CurrentProject.path & "\" & "Client Agreement.pdf"
.Display
End With
Any help/ideas appreciated. Thanks in advance.