Having an issue with shortcut menu/command bar commands (1 Viewer)

emorris1000

Registered User.
Local time
Today, 10:45
Joined
Feb 22, 2011
Messages
125
Howdy
I have some custom shortcut menus that will call some functions. In the past I've always used functions that don't take any inputs, but I'm trying to use inputs on these functions and it doesn't seem to like it. here's the code:

Code:
Sub fRunDataGraphC2Flow()
 
 
Dim cmbshortcutmenu As Office.CommandBar
Dim cmbControl As Office.CommandBarControl
Set cmbshortcutmenu = CommandBars.Add("fRunDataGraphC2Flow", msoBarPopup, False, False)
'Copy Command
cmbshortcutmenu.Controls.Add Type:=msoControlButton, Id:=19
'Adjust Axes
'function = AdjustAxis("C2Flow")
Set cmbControl = cmbshortcutmenu.Controls.Add(msoControlButton)
With cmbControl
    .Caption = "Adjust Axis"
    .Style = msoButtonIconAndCaption
    .OnAction = "AdjustAxis(""C2Flow"")"
    .FaceId = 625
    .BeginGroup = True
End With

When I try and use the command "Adjust Axis" I get the following error:

Microsoft Access cannot run the macro or callback function 'AdjustAxis("C2flow")' Make sure the macro or function exists and takes the correct parameters. The function is designed to take a string. So it should accept this, but I wonder if the quotation marks are confusing it.

Anyone have any experience with this?


edit: just to check if the quotation marks were the problem I added a string variable called "param" and then set the function call to:

.OnAction = "AdjustAxis(Param)"

Still didn't work
 

Users who are viewing this thread

Top Bottom