View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Carim[_2_] Carim[_2_] is offline
external usenet poster
 
Posts: 97
Default Application.Evaluate

On Jan 7, 6:28*pm, "Peter T" <peter_t@discussions wrote:
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- Hide quoted text -


- Show quoted text -


Peter,

Thanks a lot ... You are absolutely right ...
And you have just opened my eyes ... !!!
I 'm gonna rush to this section to implement your recommendation...
Best Regards ... and Best Wishes for the new year ...
Carim