View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default Argument with onAction in a menu.

Another way:

With .Add(msoControlButton)
.Caption = "Spara öppen kopia"
.OnAction = "Export_Data"
.Parameter = "argValue"
End With

Public Sub Export_Data()
Dim parm As String
parm = CommandBars.ActionControl.Parameter
MsgBox parm '--- displays "argValue"
End Sub



In article ,
"Zeth Larsson" wrote:

Hi out there!

I'v create a menu in a XL worksheet with commands like
With Application.CommandBars.Add("Certifiering", , False,
True)
.Visible = True
.Position = msoBarLeft
With .Controls
With .Add(msoControlPopup)
.Caption = "&CertDatabas"
With .Controls
With .Add(msoControlButton)
.Caption = "Spara öppen kopia"
.OnAction = "Export Data"
End With

Now I want to execute a sub from a .OnAction like

With .Add(msoControlButton)
.Caption = "Spara öppen kopia"
.OnAction = "Export Data argValue"
End With

Would realy appreciate a hint on how to do that, if it
can be done!

Regards
Zeth