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.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
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.
 

Treebys

Member
Outlook version
Email Account
Exchange Server
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
G Array of Outlook 2007 Errors Using Outlook 3
B CAS Array and NLB Exchange Server Administration 3
D CAS Array Question Exchange Server Administration 11
M Proper way to install Exchange 2010 SP1 on a CAS Array Exchange Server Administration 3
J Segmenting IMAP traffic from CAS Array Exchange Server Administration 8
T CAS Array/RPCClientAccessServer and Outlook profile experiences Exchange Server Administration 8
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
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 New Slipstick.com Articles 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
T Outlook 2016 Calendar multiday event display Using Outlook 4
Diane Poremsky Display the Created Date field of any Outlook item New Slipstick.com Articles 0
Diane Poremsky Replace Display Names with Email Addresses New Slipstick.com Articles 0
Diane Poremsky Search for All Messages from Contact and Display in New Window New Slipstick.com Articles 0
K Display sub-folders in body of outlook Using Outlook 1
O How to display multi-line task in To-Do List - Outlook 2010 Using Outlook 1
Diane Poremsky Display the Recipient Email Address in the Sent Items Folder New Slipstick.com Articles 0
Diane Poremsky Excel Files Won't Display in Reading Pane New Slipstick.com Articles 1
D Display of Open Folders Using Outlook 0

Similar threads

Top