Compile error..

P

Peter

Hi all,

i use this code in the "on click" event of a command button in a Access
form...

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject
Set objEmail = objOutlook.CreateItem(olMailItem)

However..i receive:

Compile error:

User-defined type not defined

Does this imply that I need to add a module:?

Thanks!
 
D

Dmitry Streblechenko

Which line produces that error?
Did you add Outlook to your project references?
Alse, the line
Set objOutlook = CreateObject
must be changed to
Set objOutlook = CreateObject("Outlook.Application")

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
P

Peter

Thanks for your reply Dimitry...

well..i see now that the error is what you mentioned..

How do i set Outlook to my project reference?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top