Link to home
Start Free TrialLog in
Avatar of kbutler
kbutler

asked on

Convert my email definitions to late binding

Can someone convert this to late binding?

Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderDrafts)
Avatar of PendragonZero
PendragonZero

I think using CreateObject("Outlook.Application") is late binding.
And early binding would be:
Set myolApp = New Outlook.Application
of course you need the reference to the Outlook Library where as in late binding you do not
Pen
Avatar of kbutler

ASKER

Acually I have late binding on some of my email procedures but the procedure that I took this code from needs to get into the Drafts forlder.
So the real problem here is the myNamespace and myFolder statements.
Dim myolApp As object
Dim myNamespace As object
Dim myFolder As object
Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderDrafts)


Done.

test be removing your refrence the  MS Outlook Obj Library.

Dave
i dont have outlook, so im not sure what value this is.. before you remove Outllok from your refrences in the debug window (intermediate window) type

?olFolderDrafts

and see what its value is, replace olFolderDrafts with this value
ASKER CERTIFIED SOLUTION
Avatar of PendragonZero
PendragonZero

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i need to learn to type faster... lol
Didnt have Outlook (and actually never used it) so i didnt know the value.
Avatar of kbutler

ASKER

PendragonZero
16 is the answer. Where do you get a listing of the other numbers?

And thanks for the answer, I tested it.
in the intermeditae window just type ?Const

it will return the value (as long as its refrenced)

to open the intermediate window, while in VBA, press ctrl+g

Dave