ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Events, Class Modules and Addins ... oh my! (https://www.excelbanter.com/excel-programming/368915-events-class-modules-addins-oh-my.html)

[email protected]

Events, Class Modules and Addins ... oh my!
 
Maybe I have bitten off more then I can chew but I would really like to
get this where I want it to go.

I have an XLA addin I created. Works great (thanks to much help from
this board).
I can now give this XLA file to anyone in my team that needs it, to
give them the functions.

But I am trying to ALSO make this addin, automatically create a toolbar
icon, linked to the function I created. This seems to have brought me
into the world of Class Modules and Events... a world I know little
about, yet.

Part of my troubles (outside of not understanding the whole process) I
believe is that most examples I have seen are linked to a specific
workbook. My process will need to be run on hundreds of workbooks,
therefore I want it to all be 'application level'. The functions all
work now on any workbook I open, but I simply cannot get even a msgbox
to pop up when I open a new or existing workbook.

Could some kind soul, give me some example code of how to do this?
Keep in mind the moment you tell me "just create a workbook open
event", you have lost me.

TIA


Jake Marx[_3_]

Events, Class Modules and Addins ... oh my!
 
Hi Robert,

Have you taken a look at Chip Pearson's tutorial on Application-level
events?

http://www.cpearson.com/excel/AppEvent.htm

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]

wrote:
Maybe I have bitten off more then I can chew but I would really like
to get this where I want it to go.

I have an XLA addin I created. Works great (thanks to much help from
this board).
I can now give this XLA file to anyone in my team that needs it, to
give them the functions.

But I am trying to ALSO make this addin, automatically create a
toolbar icon, linked to the function I created. This seems to have
brought me into the world of Class Modules and Events... a world I
know little about, yet.

Part of my troubles (outside of not understanding the whole process) I
believe is that most examples I have seen are linked to a specific
workbook. My process will need to be run on hundreds of workbooks,
therefore I want it to all be 'application level'. The functions all
work now on any workbook I open, but I simply cannot get even a msgbox
to pop up when I open a new or existing workbook.

Could some kind soul, give me some example code of how to do this?
Keep in mind the moment you tell me "just create a workbook open
event", you have lost me.

TIA




Tom Ogilvy

Events, Class Modules and Addins ... oh my!
 
But I am trying to ALSO make this addin, automatically create a toolbar
icon, linked to the function I created.


executing a macro from a commandbar button doesn't require a class module.

You have the open event (for the Addin) in the addin create the commandbar
and assign its button to a macro in your addin. Destroy the button when you
close the addin using the BeforeClose event.

Also, it doesn't require application level events.

http://msdn.microsoft.com/library/de...ce04042002.asp


the two events I spoke of are workbook level events of the Addin

http://www.cpearson.com/excel/events.htm

(this is different than what Jake suggested).

It is true that Thisworkbook module is a class module, but it is predefined
and always available. It requires little more than selecting events from
the dropdowns at the top, then adding your code to the declaration provided.

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Maybe I have bitten off more then I can chew but I would really like to
get this where I want it to go.

I have an XLA addin I created. Works great (thanks to much help from
this board).
I can now give this XLA file to anyone in my team that needs it, to
give them the functions.

But I am trying to ALSO make this addin, automatically create a toolbar
icon, linked to the function I created. This seems to have brought me
into the world of Class Modules and Events... a world I know little
about, yet.

Part of my troubles (outside of not understanding the whole process) I
believe is that most examples I have seen are linked to a specific
workbook. My process will need to be run on hundreds of workbooks,
therefore I want it to all be 'application level'. The functions all
work now on any workbook I open, but I simply cannot get even a msgbox
to pop up when I open a new or existing workbook.

Could some kind soul, give me some example code of how to do this?
Keep in mind the moment you tell me "just create a workbook open
event", you have lost me.

TIA





All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com