Arvin Mayer Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Need help with the following problem:
I'm using Arvin Meyer code for sending files from Access, but I get the
following error message:
"Complie error:
User-defined type not defined"

and it highlights the following line in the code:

" objOutlook As Outlook.Application "

What is it that I'm doing wrong?
 
Arvin's obviously using Early Binding. That means that you need to go into
Tools | References while you're in the VB Editor, scroll through the list
until you find the appropriate Microsoft Outlook n.0 Object Library entry
(where n = 8 for Outlook 97, 9 for Outlook 2000, 10 for Outlook 2002, 11 for
Outlook 2003 and 12 for Outlook 2007), select it (by checking the checkbox
to its left) and then click on OK.

Note that should your users not have the same version of Outlook installed,
you'll run into problems with this.
 
The alternative is to use late binding e.g.

Dim objOutlook As Object
Set objOutlook = CreateObject(Class:="Outlook.Application")

Doing it this way is less efficient and not quite so easy to program, but
these are small prices to pay to avoid the distribution problems which can
arise from early binding.
 
I'm a firm proponent of late binding. I was just too lazy to explain what
other changes (if any) Diogo would have to make (such as replacing named
constants)
 
Me too. If it's an unfamiliar object model I tend to use early binding to
make it easier while developing, then change to late-binding and re-test
before going into production.
 
Back
Top