How can i Create

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
 
P

papou

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top