Array out of bounds .display 2016

Status
Not open for further replies.

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.
 
or.. does it work if you use objEmail.display? Also, if you copy/pasted it, delete that line and retype it. I had issues with some leading spaces one time - for whatever stupid reason, outlook didn't see them as spaces. deleting and retyping them fixed it.
 
Sorry I forgot which forum I posted this too. It's in an Access database and I was looking at my Access forum. So ....

Diane, I think you were right, thank you. I noticed something very odd. I opened the module and searched for '.Display' it cycled through 21 instances of it in the code but did not find/recognise the problem one (in sbEmail). I tried this several times and every time it missed the two instances of it in sbEmail.

I then tried highlighting '.Display' in sbEmail and then Ctrl+F again it found the 2 in sbEmail and the other 21. I then tried searching '.Display' again and this time at found all 23. It's as though it didn't recognise the ones in sbEmail but now suddenly does!?!

Anyway, it seems to be working now. Fingers-crossed!

Thanks again.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
O VBA Outlook Message Attachment - Array Index Out of Bounds Outlook VBA and Custom Forms 0
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
G [Help] Converting array to destination folder path Outlook VBA and Custom Forms 1
J Storing userproperties to array Outlook VBA and Custom Forms 4
Dr. Demento Outlook output to array -> Excel & re-format Using Outlook 2
L Outlook clients did not reconnect to Exchange when one CAS server in CAS array became unresponsive Exchange Server Administration 1
A Why not using DAG virtual IP/fqdn for CAS array in two nodes setup? Exchange Server Administration 2
G How to insert a json array into a calendar events Outlook VBA and Custom Forms 1
S MAcro - Need help in getting the recipients in to filed / cc field toput in an array Outlook VBA and Custom Forms 4
H Attachment Array? Outlook VBA and Custom Forms 5
H Using Array for Attachments? Outlook VBA and Custom Forms 1
A message body- find any words in my array? Outlook VBA and Custom Forms 2
T How to find or display the sub-folder name for an Archive Search Using Outlook 10
Witzker Outlook 2019 Display the output of a seach in a new Window Outlook VBA and Custom Forms 6
Albert McCann Outlook 2021 Outlook Display of HTML Email from two senders is glitchy Using Outlook 0
K Outlook 365 After migrating to Outlook 365, some contacts display in emails with prefixes Using Outlook 0
K Daily Task List Minimized Cannot Display Using Outlook 5
J images on note field display fraction of size Using Outlook 5
J Outlook 2016 Can't display some embedded HTML images in Outlook 2016 Using Outlook 2
O After filtering, how to display all events on that day? Using Outlook 4
M All fonts in Outlook emails display with exaggerated character spacing Using Outlook 4
G Schedule recurring email and attachments display Outlook VBA and Custom Forms 3
O Tasks - how to display "snoozed" tasks and snooze-times? Using Outlook 7
P Task display now leaves little room for notes Using Outlook 10
R Capture Sender's Display name and Address Outlook VBA and Custom Forms 3
M Outlook 2010 How could I globally redesign an outlook template form/region/inspector template used to display mail lists or an individual mails? Outlook VBA and Custom Forms 0
Travis Lloyd Messages Won't Display In Outlook 2019 Home & Business Using Outlook 0
A Prepending Email Addrs with "Display Name <email>" Has Stopped Working Using Outlook 0
M In Outlook Calendar remove the buttons: 'Today' and '<' (Back a day) and '>' (Forward a day) that are below the Ribbon and above the calendar display. Using Outlook 0
C Why won't Title display in message list? Using Outlook 1
R Auto display of new email does not work on non-default account Outlook VBA and Custom Forms 0
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
T Column to display which email alias a message was sent to Outlook VBA and Custom Forms 6
M Daily Task List Minimized Cannot Display Using Outlook 2
C Outlook Mobile app email order randomized and display names stripped Using Outlook 6
N Contact display as Using Outlook 2
J Reminders Display then Disappear Using Outlook 13
O How to display senders email address (column) Using Outlook 1
S Display PF contact folder items to select contact to link to appointment Outlook VBA and Custom Forms 1
I How to display sender's name instead of email address in outlook 2013 message Using Outlook 5
O How to display number of items per .pst file Using Outlook 7
J Outlook 2016 message content does not display - outlook.com; exchange Using Outlook.com accounts in Outlook 9
O Display more months in 'Tasks' Using Outlook 3
soadfan Outlook rules look up display name only Using Outlook 4
C Display Sender As Contact Outlook VBA and Custom Forms 4
O How to display folder icons? Using Outlook 2
copperberry How to display incomplete tasks due on or before 7 days from now Using Outlook 0
T outlook 2010 mail item count doesnt match display Outlook VBA and Custom Forms 3
Diane Poremsky Category Color doesn't Display in Inbox Using Outlook 0
P How to make outlook display alert appear on top of other windows whenever a new email is received? Outlook VBA and Custom Forms 1

Similar threads

Back
Top