Making an MDE file with a missing reference

G

Guest

(Using Access 2003. Some computers will use the full version, some the
runtime.)

I'm adding usage of Outlook to my program. However I can't be assured that
all computers which use my program will have Outlook installed.

Therefore what I've done is to do Application.References.AddFromFile Outlook
when the switchboard opens and remove Outlook when the switchboard closes.
This lets me check to see if outlook is available and use it or not. This
seems to compile fine.

The problem comes in when I want to package the program using ADE to make an
MDE file. What causes the making of the MDE to fail is when a line such as
'Dim objOutlook As Outlook.Application' is included in the program. It gives
a "The MDE/ADE could not be created" error.

I've checked that a computer which uses the Access runtime errors on a
missing reference prior to entering the VBA code. Otherwise I could send the
program out and just check for a missing reference and not use Outlook if it
is missing.

Is there a way to make a reference optional and put the code in the program
to use the reference if available, but not require that the computer have
that reference?

thanks for any help or ideas
James
 
A

Albert D. Kallal

I'm adding usage of Outlook to my program. However I can't be assured that
all computers which use my program will have Outlook installed.

Therefore what I've done is to do Application.References.AddFromFile
Outlook
when the switchboard opens and remove Outlook when the switchboard closes.
This lets me check to see if outlook is available and use it or not. This
seems to compile fine.

No, you do not want to do the above. what happens if they have a different
version of outlook?

What happens if the directory where outlook is installed is different.

You CAN NOT expect to have ANY degree of reliability with your outlook, or
word, or Excel automation code.

The ONLY reasonable solution here is to remove the references, and use late
binding....

Tony has some nice comments on this here:

http://www.granite.ab.ca/access/latebinding.htm


I have a sample word merge routine that has been downloaded 1000's of times,
and NOT ONE person has emailed back that it don't work!!

You want to remove any reference you don't need, and any word/outlook/excel
automaton code needs to be removed also. Doing this will eliminate a HUGE
amount of support calls.
 
G

Guest

Albert,
Many thanks, I just got done making the changes and ADE made the package
without error. On to testing!!

This allowed me to get rid of a lot of code dealing with allowing the user
to browse to the Outlook path reference and what to do if it errors, etc.
Less code is good.

Thanks also for the reference philosophy in case I add "Word/Excel/etc"
items in the future.

thanks again,
James
 

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

Similar Threads


Top