A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Compile error..



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 17th 10, 10:34 AM posted to microsoft.public.outlook.program_vba
Peter
external usenet poster
 
Posts: 120
Default 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!

  #2  
Old April 18th 10, 01:37 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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!



  #3  
Old April 18th 10, 07:35 AM posted to microsoft.public.outlook.program_vba
Peter
external usenet poster
 
Posts: 120
Default 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!



.

  #4  
Old April 19th 10, 07:30 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default 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!



.



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile error: Object required brookh Outlook and VBA 2 June 14th 09 05:04 PM
Compile error hpoincare Outlook - Using Forms 1 September 9th 08 09:02 PM
Compile error? Cam Outlook and VBA 5 April 23rd 08 02:43 PM
Outlook.MAPIFolder: for each compile error spareway Add-ins for Outlook 1 January 29th 07 02:05 PM
What is: Compile Error in hidden module: AutoExecNew Guitar125 Outlook and VBA 1 July 7th 06 05:52 AM


All times are GMT +1. The time now is 06:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.