I have the following script to add a commandbar, however I can not get the onaction script to call the macro, the macro is located in a module.
Code:
Sub AccessButton1()
On Error Resume Next
CommandBars("MyCommandBar").Delete
Dim cmb As CommandBar
Set cmb = Application.CommandBars.Add("MyCommandBar")
cmb.Visible = True
' Add a command button
Dim cbc As CommandBarControl
Set cbc = cmb.Controls.Add(msoControlButton)
cbc.Caption = "Button1"
cbc.Style = msoButtonIconAndCaption
cbc.OnAction = "=test3()"
end sub