vba - Catch an event in a different workbook -
i wondering if possible catch event in workbook.
a macro open workbook user use, , want able run macro on selection_change event. no, code can't stored in opened workbook.
is there other way programmatically adding code opened workbook's thisworkbook
module?
that way unsafe , unstable , bleh.
all need grab withevents
reference opened workbook in class module event handlers. example:
'in thisworkbook option explicit private withevents other worksheet private sub example() dim wb workbook set wb = workbooks.open("c:\dev\other.xlsx") set other = wb.sheets("sheet1") end sub private sub other_selectionchange(byval target range) debug.print target.address end sub
Comments
Post a Comment