user882670
user882670

Reputation:

Call macro from custom button in Ribbon

The following macro runs ok, when called from Developer -> Macros - Macro1

Sub Macro1()

ThisWorkbook.FollowHyperlink "http://www.portal-gestao.com/financas.html"

End Sub

But, since I'm using a custom button in the Ribbon, I'm calling the macro like:

<button id="customButton4" label="Finanças"  onAction="Macro1" imageMso="HyperlinkInsert" />

Which is returning the error:

Wrong number of arguments or invalid property assignment

Basically, I want to open a web page when the user clicks a custom button on the ribbon. How do I do that?

Upvotes: 0

Views: 1823

Answers (1)

Andy G
Andy G

Reputation: 19367

You need to modify your macro to include this parameter:

Sub Macro1(control As IRibbonControl)

Upvotes: 2

Related Questions