Can I assign a function in an excel add-in to a button in the workbook?

为君一笑 提交于 2020-05-09 06:35:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!