Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi NG
Sometime when using callbacks e.g. .OnAction then it could be nice to pass some parameters to the macro. Does anyone have a suggestion on how that might be accomplished. Mark |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mark,
I think you sent me on a wild goose chase there. You don't mean Callbacks do you? As to passing a parameter to OnACtion, that is easily achieved with Here is an example from my system sAction = "'PERSONAL.XLS'!'PasteComments ""Bob"'" .OnACtion = sACtion -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Mark" wrote in message ... Hi NG Sometime when using callbacks e.g. .OnAction then it could be nice to pass some parameters to the macro. Does anyone have a suggestion on how that might be accomplished. Mark |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There is a method to do it, but it is unsupported and I believe xl2002 and
beyond don't support it anymore. Sub SetAction() Selection.OnAction = "'mymacro 1, 2'" End Sub Sub mymacro(one, two) MsgBox one & " " & two End Sub so enclose the string in single quotes. -- Regards, Tom Ogilvy "Mark" wrote in message ... Hi NG Sometime when using callbacks e.g. .OnAction then it could be nice to pass some parameters to the macro. Does anyone have a suggestion on how that might be accomplished. Mark |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With Commandbars("Mybar").Controls.Add(type:=msoControl Button)
.Caption = "MS1" .OnAction = "MySub" .Parameter = 1 End with With Commandbars("Mybar").Controls.Add(type:=msoControl Button) .Caption = "MS2" .OnAction = "MySub" .Parameter = 2 End With Then in your sub: Public Sub MySub() For i = 1 to CommandBars.ActionControl.Parameter 'Do stuff once or twice Next i End Sub or Public Sub MySub() If CommandBars.ActionControl.Parameter = 1 Then 'Do Stuff for button MS1 ElseIF CommandBars.ActionControl.Parameter = 2 Then 'Do Stuff for button MS2 Else MsgBox "Don't Understand " & _ CommandBars.ActionControl.Parameter In article , "Mark" wrote: Hi NG Sometime when using callbacks e.g. .OnAction then it could be nice to pass some parameters to the macro. Does anyone have a suggestion on how that might be accomplished. Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Paramters or Arugment Auto-Label for User-Defined Function | Excel Worksheet Functions | |||
Parsing | Excel Discussion (Misc queries) | |||
Database query with a range of cells as paramters? | Excel Discussion (Misc queries) | |||
Instead of Parsing | Excel Discussion (Misc queries) | |||
Parsing help | Excel Programming |