Solved

Convert my email definitions to late binding

Posted on 2004-09-13
9
535 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
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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 500 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

832 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