ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OnAction procedure (https://www.excelbanter.com/excel-programming/311488-onaction-procedure.html)

Max Potters

OnAction procedure
 
Hi all,

I would like to use the OnAction procedure, but I want to give an argument
to it as well... For example:

..OnAction = "module(i)"

I don't know for sure if this method works, but I guess not. Does anyone
know how to put an argument in the onaction statement?

thanks in advance

Max



Bob Phillips[_6_]

OnAction procedure
 
Max,

Like this

..OnAction = "module " & i

--

HTH

RP

"Max Potters" wrote in message
...
Hi all,

I would like to use the OnAction procedure, but I want to give an argument
to it as well... For example:

.OnAction = "module(i)"

I don't know for sure if this method works, but I guess not. Does anyone
know how to put an argument in the onaction statement?

thanks in advance

Max





Tom Ogilvy

OnAction procedure
 
..OnAction = "'" & ThisWorkbook.Name & "!MyMacro i'"

--
Regards,
Tom Ogilvy


"Max Potters" wrote in message
...
Hi all,

I would like to use the OnAction procedure, but I want to give an argument
to it as well... For example:

.OnAction = "module(i)"

I don't know for sure if this method works, but I guess not. Does anyone
know how to put an argument in the onaction statement?

thanks in advance

Max





Tom Ogilvy

OnAction procedure
 
of course if you want i to be a variable

..OnAction = "'" & ThisWorkbook.Name & "!MyMacro " & i & "'"

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
.OnAction = "'" & ThisWorkbook.Name & "!MyMacro i'"

--
Regards,
Tom Ogilvy


"Max Potters" wrote in message
...
Hi all,

I would like to use the OnAction procedure, but I want to give an

argument
to it as well... For example:

.OnAction = "module(i)"

I don't know for sure if this method works, but I guess not. Does anyone
know how to put an argument in the onaction statement?

thanks in advance

Max







Michel Pierron

OnAction procedure
 
Hi Max,
For each item:
..OnAction = ThisWorkbook.Name & "!MyMacro"

' Example for menu (2 items / separator / 1 item)
Sub MyMacro
Select Case Application.Caller(2)
Case 1: ThisWorkbook.Save
Case 2: ActiveWindow.SelectedSheets.PrintPreview
' NewGroup then add 1
Case 4: ThisWorkbook.Close False
End Select
End Sub

Regards,
MP

"Max Potters" a écrit dans le message de
...
Hi all,

I would like to use the OnAction procedure, but I want to give an argument
to it as well... For example:

.OnAction = "module(i)"

I don't know for sure if this method works, but I guess not. Does anyone
know how to put an argument in the onaction statement?

thanks in advance

Max






All times are GMT +1. The time now is 02:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com