vba - Cannot select Sheet in ActiveWorkbook inside XLAM Excel-AddIn -



vba - Cannot select Sheet in ActiveWorkbook inside XLAM Excel-AddIn -

i trying select worksheet within activeworkbook (the 1 calls macro). appears select sheet hasn't when seek , print out activesheet name.

activeworkbook.worksheets("query tables").activate ' select has same result activate msgbox activeworkbook.sheets("query tables").name msgbox activeworkbook.name & vbtab & activesheet.name

this how phone call sub within add-in workbook.

application.run "qtanalyser.xlam!mymacro()"

what doing wrong?

the workbook , worsheet objects of .xlam file may in-activated, because they're not supposed accessible excel user interface.

modify code this:

call application.workbooks("myaddin.xlam").activate phone call activeworkbook.worksheets("query tables").activate msgbox activeworkbook.sheets("query tables").name msgbox activeworkbook.name & vbtab & activesheet.name

where "myaddin.xlam" should changed file name.

later edit

the activeasheet property may linked application, window or workbook object. solve ambiguity, try:

call application.activeworkbook.worksheets("query tables").activate msgbox application.activeworkbook.sheets("query tables").name msgbox application.activeworkbook.name & vbtab & application.activesheet.name

vba

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -