Open a code window, go to Tools/References. Scroll own the list
(it's alphabetical) until you find the "Microsoft Excel 12.0 Object Library"
reference, check it , then click OK.
Take a look at the AddFromFile or AddFromGUID methods of the References
collection.
In general, though, using Late Binding means you don't have to worry about
setting a reference. Tony Toews has an introduction to the topic at http://www.granite.ab.ca/access/latebinding.htm
On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "SetReferenceToDAO.mdb" which programmatically sets a
reference to DAO (Microsoft DAO 3.6 Object Library) if it does not exist.
Setting a reference to Excel would be similar and you should be able to
generalize from it.
Now why do you want to add a reference on the fly? Or will late
binding take care of the issues?
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
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.