How can i Create

  • Thread starter Thread starter Norton
  • Start date Start date
N

Norton

Hi all,


I would like to add some menu Item based on the following code but it
returns failed. The reason is that i pass an parameter on "OnAction" which
excel file cannot find the macroname RunTest(1)

Here is my code
==========================================
MenuBars(xlWorksheet).Menus(menuName).MenuItems.Add Caption:=itemName,
OnAction:=RunTest(1)



Public Sub RunTest(ByVal iParameter as integer)
Msgbox(iParameter)
End Sub
===================================

What can i do?


Regards,
Norotn
 
Hello Norton
Since your macro takes a parameter, OnAction will not accept it as it is.
So provided Runtest will always take 1 on its parameter for the Onaction
method,I would suggest you create another macro to run your Runtest macro
and use this new macro name instead.

HTH
Cordially
Pascal
 
Back
Top