Discussion Locked

OCX and DLL files in VBA

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello,
Can someone help me out. I need to know if you can get the ocx or dll files in the reference section in VBA to load up automatically when your macro starts. I am writing a macro that needs the DAO reference loaded but am unable to finda command that can do this within the macro itself. If anyone can help I would appreciate it.

Thanks,
Matt...

3 replies

by mikedale

In Excels VBA Editor (Tools - Macro - Visual Basic Editor). CLICK on the Tools Menu then select Referances. A dialog box will appear that will display a list of the DLLs installed on your computer. If you scroll done the list to the DLLs you willfind a group labelled 'Microsoft DAO x.xx Object Library'. (Note: You will need Access or VB on your computer to have these DLLs present. I am assuming from your question that the DAO DLL you want is installed on your Computer.) Tick the DAO library to want then click OK.

Note the DLL will be loaded when the spreadsheet is opened. I did set up a macro in excel to read some data from one of my Access databases, worked well.

Hope this helps

Mike

by matthew.done

I know how to get the reference loaded but what about for portability. If I load the macro on someone else's computer without the reference loaded then the macro won't work. My question is I won't to load this reference up in the Auto_Open proceedure and on error display message that says you cannot use this macro because you don't have the neccessary components loaded.
Thanks anyway....

This discussion is closed to new replies.