(XL2007, Vista) I am creating a new worklbook from a template. One of the sheets in the new workbook has a selection of three cells as "buttons". The Worksheet_SelectionChange event is supposed to call a macro in an add-in and pass the Target.Address as a string variable.
I did just have the three cells call three separate macros from the add-in, without passing any variables, and those worked fine. But then it dawned on me that I couldn't add any new functionality in files created on that template because I couldn't get to the VBE to add a call to a new macro. So if I just call a macro in the add-in that figured out what to do based on the Target.Address, then I could update the add-in as needed with new functions.
Now, though, calling the add-in macro gets me a 1004 error:
"Cannont run the macro 'MyAddIn.xlam!doTarget(strAddress)'. The macro may not be available in this workbook, or all macros may be disabled."
This error occurs no matter which cell I select on the sheet. The code stops on the "Application.Run" line.
Any help on fixing this?
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim strAddress As String strAddress = Target.Address Application.Run "MyAddIn.xlam!doTarget(strAddress)" End Sub