View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Application.Evaluate

A string is a string, like "abc", it's not an instruction or a formula. I
suspect you don't mean evaluate. Also a 'Sub' does not return a result like
a function, so what you mentioned in your OP does not make any sense.

If(?) you mean you want to "call" the procedure named Command#_Click() that
exists in a sheet module, try something like this -

sProc = Worksheets("Sheet1").CodeName & ".CommandButton" & i & "_Click"
Application.Run sProc

or
sProc = "CommandButton" & i & "_Click"
CallByName Worksheets("Sheet 1"), sProc, VbMethod

Or if(?) the procedure is in a Userform and you are calling it in a userform
sProc = "CommandButton" & i & "_Click"
CallByName Me, sProc, VbMethod

You will need to change Private to Public before the procedure names in the
sheet/userform module (or simply delete Private).

Regards,
Peter T


"Carim" wrote in message
...
Not sure to understand your remark ...
The string is the instruction I would like to have executed ...
How should I use the Application.Evaluate instruction to execute
the Command#_Click() ... ?

Thanks for your help