PDA

View Full Version : Solved: Best way to go about?



shankar
04-05-2009, 05:09 AM
Hi, I am new to VBA for Excel. I need to create a custom VBA application that runs in Excel. I will be having a lot of separate data files (workbooks), though only one will be loaded at a time in Excel.

The VBA application would customize the toolbars and the Ribbon, till the time the application is removed or Excel is quit.

My question is, where do I keep my VBA code? I don't want the code being replicated in every workbook since it is a waste of disk space. Also if I make a change to the code, it should get reflected for all workbooks that use the application.

I have read something about add-ins, but I am not sure if that's the way to go. In my current template workbook, I have VBA procedures under ThisWorkbook, Sheet1, etc to handle events associated with them. Now if I have the code sitting somewhere other than these locations, will I still be able to handle those events for the actual workbook I will be working with?

Thanks for any suggestions.

Shankar

Bob Phillips
04-05-2009, 07:05 AM
Add-ins are the way to go.

Zack Barresse
04-05-2009, 08:49 AM
Hi, welcome to the board!

Definitely add-in. As to your events question, it depends what events and their scope that you're wanting to capture. You can use a class module to trap events for any workbook. You can do what you're asking in an add-in though, yes.