Jim
Jim

Reputation: 3

Changing from Early to Late Binding

I followed these instructions to convert from early to late binding: Convert Early Binding VBA to Late Binding VBA : Excel to Outlook Contacts

The code was working with early binding but now comes up with

Run-time error '5': invalid procedure call or argument 

on the following line:

Set SentItemsFolder = myNamespace.GetSharedDefaultFolder(myRecipient, olfolderinbox).Parent.Folders("Sent Items")

I tried

dim olfolderinbox as object

Upvotes: 0

Views: 206

Answers (1)

Nacorid
Nacorid

Reputation: 793

When converting from early to late binding you also have to change named enumerations to their actual values.

olFolderInbox is part of the OlDefaultFolders enumeration.
Its value is 6.

Changing your line to

Set SentItemsFolder = myNamespace.GetSharedDefaultFolder(myRecipient, 6).Parent.Folders("Sent Items")

will fix the problem as long as myRecipient is correct.

Upvotes: 1

Related Questions