vba - What is the entry point of an .xlam excel addin -
i doing work on excel addin abc.xlam. addin enabled in excel addins. want launch .exe file whenever open worksheet (new or existing) in excel. want code .exe launch part in .xlam addin @ event when workbook opened. please tell me how can ?
you need access newworkbook
event of excel appliation, need set reference application
object when addin loads.
put following example code in thisworkbook
module:
option explicit '***** use option explicit! private withevents oxl application private sub oxl_newworkbook(byval wb workbook) '***** trapping newworkbook event call msgbox("it's me again. (" & oxl.workbooks.count & ")", vbinformation, "hi. again.") '***** code here! end sub private sub workbook_beforeclose(cancel boolean) '***** remove reference oxl object set oxl = nothing end sub private sub workbook_open() '***** set reference current excel application set oxl = thisworkbook.application '***** testing oxl object call msgbox("hello, there! (" & oxl.workbooks.count & ")", vbinformation, "hi") end sub
Comments
Post a Comment