PDA

View Full Version : COM add-in as a DLL in VBA



gibbo1715
10-01-2005, 10:04 AM
I have been really interested in the com add in idea since I heard about it here, So Using office 2000 developer I have created a com addin which saves as a DLL file.

Having done this (And was until now feeling pretty pleased i actually managed it) I now have no idea how i can access the dll file to use it in my application?

I ve tried reading some of the Microsoft stuff etc but still cant find the answer

Can anyone here tell me how (Or where) to start and where i can read up on the subject in more detail please as its driving me nuts at the moment

Im sure im probably missing something straightforward here

Thanks

Gibbo

Norie
10-01-2005, 10:28 AM
Wouldn't you just create a reference to it in Tools>References...?

gibbo1715
10-01-2005, 10:33 AM
Thanks Norie,

didnt even realise that was how to get to it,

next question is that my add in contains a userform, how can i open it or is this sort of thing not possible with a com addin?

Also found this link which is of interest re getting to the addin

http://www.officearticles.com/misc/how_to_install_a_com_addin_in_microsoft_office_applications.htm

XL-Dennis
10-01-2005, 03:45 PM
Hi,

I believe that Mark007 nice article will be of great interest for You:

http://www.thecodenet.com/articles.php?id=38

Kind regards,
Dennis

gibbo1715
10-02-2005, 12:12 AM
Thanks Dennis, that does take me one step nearer, but i am still unsure if and how i can call a userform that is contained within a com addin,

Any help really appreciatted as this really is bugging me

Cheers

Gibbo

XL-Dennis
10-02-2005, 03:54 AM
Gibbo,

Userforms are usually launched via commandbutton or menu options and since we can create both these control I wonder what You have in mind when You raise the question.

The menu option as well as toolbar where commandbuttons reside are created within the COM add-in.

Kind regards,
Dennis

gibbo1715
10-02-2005, 04:09 AM
Thanks for the reply

So am I right in thinking I can add a button to a menu and use that to call a form hidden within a com addin?

I have a few ideas of how i would like to use this ibut am really learning the possibilities at this stage hence the question, My main reason is to be able to hade my code from my users in as secure a method as possible.

In my searching for a way of making my code more secure I did find the following that may interest a few people here

http://www.mrexcel.com/board2/viewtopic.php?t=167686&highlight=com+addin

Gibbo

XL-Dennis
10-02-2005, 04:32 AM
Hi Gibbo,



So am I right in thinking I can add a button to a menu and use that to call a form hidden within a com addin?


Absolutely and that's why I pointed You to Mark007's article :)

Creating COM add-ins is the best way if we want to fully protect the code. However, as You have noticed it also require much more of us then creating regular Excel add-ins.

Anyway, please continue to ask Your questions :thumb

Kind regards,
Dennis

gibbo1715
10-02-2005, 05:56 AM
Thanks Denis

Moving ahead of myself a bit, what I ultimately want is to have a menu item and when clicked it enables a set of userforms hidden in the com addin that will then use the excel sheets to store data in (kinda small database), would also hide excel from view, so my users have to interact with excel via the userforms i ve created.

When the forms are closed it will save the workbook and data, so my users cannot manipulate the data and excel remains hidden throughout.

When the saved workbook is re opened you would be taken straight to the userforms and excel is hidden again as above.

I can and have already done this using vba in excel,

But my question is if i used a com addin would I need to get the addin to create the relivent code and create the forms within the workbooks vba (And therefor loose my hidden code and the reason for a com addin in the first place), or can it reference the hidden forms and code within the com addin some how?

I assume as I can get a userform to display via a button on my menu the above is not impossible, or am I trying to push things a bit too far?

Cheers

Gibbo