问题
I want to have a button in the sheet that you can press that will run part of the add in. Is this possible?
回答1:
ok ill look into that. but is there a way to do so with a button in a sheet? – Jacxel 7 mins ago
Yes you can.
I am assuming that you have an Add-In called MyAddIn.xlam and you have a procedure called `Sample()' in the module of the Add-In. I am also assuming that the Add-In is installed.
Replace the file MyAddIn.xlam with the relevant Add-In name and replace the procedure Sample with the relevant procedure name.
Option Explicit
Private Sub CommandButton1_Click()
Application.Run "MyAddIn.xlam!Sample()"
End Sub
来源:https://stackoverflow.com/questions/10636336/can-i-assign-a-function-in-an-excel-add-in-to-a-button-in-the-workbook