Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Compile error.. (http://www.outlookbanter.com/outlook-vba/101914-compile-error.html)

Peter April 17th 10 10:34 AM

Compile error..
 
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!


Dmitry Streblechenko April 18th 10 01:37 AM

Compile error..
 
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
-
"Peter" wrote in message
...
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!




Peter April 18th 10 07:35 AM

Compile error..
 
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!

"Dmitry Streblechenko" wrote:

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
-
"Peter" wrote in message
...
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!



.


Dmitry Streblechenko April 19th 10 07:30 PM

Compile error..
 
Click Tools | References in the VBA editor.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Peter" wrote in message
...
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!

"Dmitry Streblechenko" wrote:

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
-
"Peter" wrote in message
...
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!



.





All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com