Solved

Convert my email definitions to late binding

Posted on 2004-09-13
9
538 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Connecting to MSSQL server from MS Access 5 51
On Key Down Access 2010 6 41
Search a table based on a "like" search 6 44
Random times with 12/24 hour switching 9 28
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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 views 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 Microsoft Access…
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…

860 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