Getting error while compile

Hi Exparts,

I have a Access DB, while I compile it giving me the following error:
"User-defined type not defined"
Compile error occured in the following line:

Dim myOlApp As Outlook.Application

I am using office 2010, I am not sure if I am missing any reference, if so which reference.

Please advise.

Thanks
alam747Asked:
Who is Participating?
 
NorieConnect With a Mentor VBA ExpertCommented:
You need a reference to Microsoft Outlook x.0 Object Library.

x will depend on your version of Outlook, eg fot Outlook 2010 it's 14.0.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Connect With a Mentor Commented:
Or use Late Binding so you don't have to worry about the Reference:

Example:

  Dim oOutlook As Object

  Set oOutlook= CreateObject("Outlook.Application")

See these KBs for more info:

Using early binding and late binding in Automation
http://support.microsoft.com/kb/245115

Late Binding in Microsoft Access
http://www.granite.ab.ca/access/latebinding.htm

mx
0
 
alam747Author Commented:
Thanks a lot
0
All Courses

From novice to tech pro — start learning today.