MAPI and Visual Basic For Applications

R

Richard

Hi Everyone, hope comeone can help

I'm using Access 2000 to generate emails in Outlook 2000. I've been ok at doing simple emails using code such a
Set objOutlook = CreateObject("Outlook.Application"
Set objOutlookMsg = objOutlook.CreateItem(olMailItem
With objOutlookMs
Set objOutlookRecip = .Recipients.Add("Nancy Davolio"
etc...

References tell me that MAPI can do some interesting things, but I'm having trouble compiling sample source code when attempting to use MAPI
e
Const strServer = "MyServer
Const strMailbox = "MyMailbox
Dim objSession As MAPI.Sessio

Fails on the third line "User defined type not defined". Might seems like a silly question, but what could I be missing, or where can I look to resolve this issue

Any help would be appreciated

Regards, Richard
 
A

Alan

Richard said:
Hi Everyone, hope comeone can help.

I'm using Access 2000 to generate emails in Outlook 2000. I've been
ok at doing simple emails using code such as
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("Nancy Davolio")
etc....

References tell me that MAPI can do some interesting things, but I'm
having trouble compiling sample source code when attempting to use
MAPI.
eg
Const strServer = "MyServer"
Const strMailbox = "MyMailbox"
Dim objSession As MAPI.Session

Fails on the third line "User defined type not defined". Might seems
like a silly question, but what could I be missing, or where can I
look to resolve this issue.

Any help would be appreciated.

Regards, Richard.

Hi Richard,

I am guessing that your code is in a module in Access, and that the
Dim statement attempted to create an object of type MAPI.Session that
is not a valid (standard) object in Access.

You'll need to define it in terms of an Outlook object.

HTH,

Alan.
 
S

Sue Mosher [MVP-Outlook]

MAPI.Session refers to CDO 1.21, which is an optional component for Outlook.
Run Office/Outlook setup and install Collaboration Data Objects if it's not
already installed.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Richard said:
Hi Everyone, hope comeone can help.

I'm using Access 2000 to generate emails in Outlook 2000. I've been ok at
doing simple emails using code such as
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("Nancy Davolio")
etc....

References tell me that MAPI can do some interesting things, but I'm
having trouble compiling sample source code when attempting to use MAPI.
eg
Const strServer = "MyServer"
Const strMailbox = "MyMailbox"
Dim objSession As MAPI.Session

Fails on the third line "User defined type not defined". Might seems like
a silly question, but what could I be missing, or where can I look to
resolve this issue.
 
Top