Arvin Mayer Code

D

Diogo

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?
 
D

Douglas J. Steele

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.
 
B

Baz

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.
 
D

Douglas J. Steele

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)
 
B

Baz

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.
 

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