I have an add-in file, MyAddIns.xlam, that contains a module named Module1 with a number of functions that are intended to be mapped to buttons in another spreadsheet. One example is the following:
Originally it was "Private Sub Test(), but that gave the same error as I will describe below. Also I changed the sub name to "Test" to avoid any possibility of collision with the name of the sheet function that is supposed to call this sub.
I have a spreadsheet, MyDashboard.xlsm, that contains a number of ActiveX buttons intended to be mapped to the functions defined in MyAddIns.xlam.
When I open MyDashboard.xlsm, I go to Developer->Add Ins, check the box for "MyAddIns", and then click OK.
On MyDashboard.xlsm, Sheet1, I have a button named "Generate Data". When I right click the button and select "View Code", I see the following code:
This seems like button GenerateData should call the Test subroutine from Module1 whenever I click it, yet whenever I do I receive the following error:
Any ideas what the problem could be? I also tried prefixing the sub call with "Module1.", but then I get the following error:
Any ideas?
Code:
Public Sub Test()
...
End Sub
Originally it was "Private Sub Test(), but that gave the same error as I will describe below. Also I changed the sub name to "Test" to avoid any possibility of collision with the name of the sheet function that is supposed to call this sub.
I have a spreadsheet, MyDashboard.xlsm, that contains a number of ActiveX buttons intended to be mapped to the functions defined in MyAddIns.xlam.
When I open MyDashboard.xlsm, I go to Developer->Add Ins, check the box for "MyAddIns", and then click OK.
On MyDashboard.xlsm, Sheet1, I have a button named "Generate Data". When I right click the button and select "View Code", I see the following code:
Code:
Private Sub GenerateData_Click()
Call Test
End Sub
This seems like button GenerateData should call the Test subroutine from Module1 whenever I click it, yet whenever I do I receive the following error:
Code:
Compile Error:
Sub or Function not defined
Any ideas what the problem could be? I also tried prefixing the sub call with "Module1.", but then I get the following error:
Code:
Run-time error '424':
Object required
Any ideas?