I have a scenario where we need to open a number of spreadsheets on a server, update a number of worksheets on each workbook by means of an add in button.
So the user opens remote desktop, opens a spreadsheet, goes to sheet x, goes to the add-ins menu and clicks a button. This button updates the data on the sheet which takes several seconds. Then they open sheet y and repeat. Eventually all sheets are updated and the user saves and closes the sheet.
I am trying to automate this. My thinking is to have a "master excel document" with a button to execute VBA code which will:
My major problem right now is that I need to figure out how to execute the Add-in function from my VBA code. I have researched and found that I need to run it using code like this: APPLICATION.RUN "ADDIN_NAME.XLA!SUBNAME"
I think I have the ADDIN_NAME (found this by clicking file, options, add-ins). But I cannot figure out how to get the subname.
Using the Macro recorder doesn't work - no code is recorded for clicking the add-in button. When I hover my mouse over the add-in button, it give me "Analyst : Refresh Report, Use Current Criteria". Any suggestions as to how I could work out what the subname is?
You could pry open the xls(m?) file by renaming it to zip, open it in ZIP, navigate to the customUI/customUI.xml and open that in Notepad. Reading that should give you the name of the macro each button added is calling.
eg.
....size="large" onAction="showuserform" imageMso="CreateRepo....
where showuserform
is the name of the macro being called.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.