I'm trying to create a command button within a worksheet that runs a macro from a different addin.
The buttin is created as part of a VBA macro. I can get it to work with macros that exist in the same addin to the one creating the buttion:
But I can't make it run a macro from a different addin:
All I get is a command button that I can't click on (I can only 'select' it).
Any ides?
The buttin is created as part of a VBA macro. I can get it to work with macros that exist in the same addin to the one creating the buttion:
Code:
ActiveSheet.Buttons.Add(320, 380, 50, 40).Select
Selection.Name = "btnRunMacro1"
Selection.OnAction = "macro1"
ActiveSheet.Shapes("btnRunMacro1").Select
Selection.Characters.Text = "Run macro 1"
But I can't make it run a macro from a different addin:
Code:
otherAddin = "C:\Excel Addins\OtherAddin.xlam"
ActiveSheet.Buttons.Add(390, 380, 50, 40).Select
Selection.Name = "btnExternalMacro"
Selection.OnAction = otherAddin & "'!macro1'"
ActiveSheet.Shapes("btnExternalMacro").Select
Selection.Characters.Text = "Run external macro 1"
All I get is a command button that I can't click on (I can only 'select' it).
Any ides?