开发者

In Excel, is there a way to determine the method being called by a password protected 3rd-party ribbon button?

开发者 https://www.devze.com 2023-03-19 15:49 出处:网络
I\'m looking to automate a simple process in VBA and need to \"click\" a ribbon button.It开发者_运维知识库 makes the most sense to just call the button\'s underlying method.Is there a way to figure ou

I'm looking to automate a simple process in VBA and need to "click" a ribbon button. It开发者_运维知识库 makes the most sense to just call the button's underlying method. Is there a way to figure out what it is?

We are using Excel 2007 and 2010.


If it's Excel 2003 or earlier, you can use the CommandbarControl.Execute method. For instance:

Application.Commandbars("3rd Party Toolbar").Controls("Button to Push").Execute


There are two ways you can do this.

  1. Right click on the toolbar and select Customise. If you right click on the button there may be details somewhere of what Macro the button is associated with.

  2. If you record a macro and click the button. Then you can look at the VBA workspace and view the code that is generated to run your macro (which is just clicking the button you want). This will show you what method the macro clicks.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号