how to handle 'sheetchange' event on 'add-in'

T

Takoyaki

Hello,
I hope to know how can I handle the sheetchange event on my add-in xla
program?
you know, If I create add-in, It's not part of what I working project.
So, I can't handle the event.
Thanks!
 
B

Bob Phillips

Hi Takoyaki,

You could create application events in your add-in, and test for applicable
workbooks.

In the add-in ThisWorkbook module add,

Private Sub Workbook_Open()
Dim AppClass As clsAppEvents

Set AppClass = New clsAppEvents
Set AppClass.App = Application

End Sub

also create a class, call it clsAppEvents, add this line

Public WithEvents App As Application

then run the Workbook_Open code, and in the class dropdown, you will se App
as an object, and then you can select the SheetChange event.


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
T

Takoyaki

Thanks Bob!!
I'm really thank you !


Bob Phillips said:
Hi Takoyaki,

You could create application events in your add-in, and test for
applicable
workbooks.

In the add-in ThisWorkbook module add,

Private Sub Workbook_Open()
Dim AppClass As clsAppEvents

Set AppClass = New clsAppEvents
Set AppClass.App = Application

End Sub

also create a class, call it clsAppEvents, add this line

Public WithEvents App As Application

then run the Workbook_Open code, and in the class dropdown, you will se
App
as an object, and then you can select the SheetChange event.


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top