How to add code module to Excel programmatically
"deko" wrote in message
om...
Why not just create a template workbook with a userform.
And do things the easy way??!! Unfortunately, that would require users to
do something differently, and politics being as they are, that's not an
option.
No, I'm thinking nothing to do with the users, you can open that template in
VBA, so you keep control.
The thing I'm concerned about is having to add code to every worksheet -
that would require looping through all the worksheets and inserting a lot
of
redundant code, would it not? On the other hand, inserting a module
sounds
simple enough, but can that one module get a button on each worksheet in
the
workbook?
Adding a module is simple, so is inserting procs in those nodules, but
remember, each sheet has a class module automatically created with it that
can be used. In addition, you can add workbook events that can apply to all
sheets.
One procedure can create buttons on each worksheet, but why not create a
toolbar button instead, which can test what the activesheet is at runtime?
|