View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Argument with onAction in a menu.

Zeth,

On behalf of myself and (I am sure) JE, you're more than welcome. Have a
happy holiday.

The one thing neither JE or I mentioned is that the great strength of
arguments is changing them on the fly. Both solutions are static, the
argument value is set up front. It is very easy to set it just as easily on
the fly with code such as

With Application.CommandBars("Certifiering")
With .Controls("&CertDatabas").Controls("Spara öppen kopia")
.OnAction = "'" & ThisWorkbook.Name & "'!'Export_Data ""xyz""'"
End With
End With

JE's code (not tested) would be

With Application.CommandBars("Certifiering")
With .Controls("&CertDatabas").Controls("Spara öppen kopia")
.Parameter = "New Value"
End With
End With


Regards

Bob

"Zeth Larsson" wrote in message
...
I'm not familiar with this forum yet, I hope this reply
comes right.

Many Thanks Bob Phillips and J.E. McGimpsey!
I'v could verify both your solutions as perfectly
functional.

It spare me lots of trouble with "work around".

Hope you both get a Merry Chrismas and a Happy New Year
2004!
Zeth Larsson
Valbo Sweden





-----Original Message-----
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
.