Checking & installing references as part of on_open

K

KR

I have a macro that access MS Outlook data from Excel (mixed platform, users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code check for
a reference to outlook, and if there isn't one "check the box" to activate
the reference? What makes this more problematic is the multiple platforms,
so I'm not sure how to hardcode the multiple possible reference names. I am
sticking with early binding, because so far I haven't learned enough to make
late binding work (I've tried).

The idea of walking every user through the process of opening up the VBE,
adding the reference, etc. is daunting, so I'd like to do this automatically
if possible.

Many thanks,
Keith
 
B

Bob Phillips

Use late binding.

Dim oOLApp as Object

with

Set oConn = CreateObject("Outlook.Application")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
K

KR

I have tried late binding, but then I have all sorts of other problems
getting the rest of my outlook code to work (I'm not a programmer by
training or profession, I'm just learning as I go). Is there a web page
reference anywhere that shows how to take early binding code, and what needs
to be done to it, in order to make it work when late binding is used? I have
a basic notion of the difference between early and late binding, just not
the details of how to make it work.

Thanks,
Keith
 
J

JPL

I've just had a similar problem with a reference to MDAC, and late binding
did not solve the problem, it simply moved it from when the spreadsheet
opened to when the CreateObject call was made. Since the exeception was not
caught by On Error.., it was not possible to handle it cleanly.

JPL
 
B

Bob Phillips

What error was not caught?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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