?
Solved

Convert my email definitions to late binding

Posted on 2004-09-13
9
Medium Priority
?
548 Views
Last Modified: 2012-05-05
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)
0
Comment
Question by:kbutler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 2

Expert Comment

by:PendragonZero
ID: 12051434
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
0
 

Author Comment

by:kbutler
ID: 12051490
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.
0
 
LVL 34

Expert Comment

by:flavo
ID: 12051523
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

Expert Comment

by:flavo
ID: 12051528
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
0
 
LVL 2

Accepted Solution

by:
PendragonZero earned 2000 total points
ID: 12051535
btw, using late binding, you cant use Outlook constants like olFolderDrafts
i think olFolderDrafts = 16

so try flavo's code with
Set myFolder = myNamespace.GetDefaultFolder(16)

0
 
LVL 2

Expert Comment

by:PendragonZero
ID: 12051539
i need to learn to type faster... lol
0
 
LVL 34

Expert Comment

by:flavo
ID: 12051552
Didnt have Outlook (and actually never used it) so i didnt know the value.
0
 

Author Comment

by:kbutler
ID: 12051563
PendragonZero
16 is the answer. Where do you get a listing of the other numbers?

And thanks for the answer, I tested it.
0
 
LVL 34

Expert Comment

by:flavo
ID: 12051566
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
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question