Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Application.Evaluate

Hi,

In a class module, within a Private Sub ButtonGroup_Click() , I cannot
have the
Application.Evaluate to execute itself ...
I am stuck with these two lines :

Back2Top = "CommandButton" & z & "_Click"
Application.Evaluate (Back2Top)

Thanks a lot for your help
and Happy New Year
Cheers
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Application.Evaluate

What are you trying to evaluate, as written Back2Top is simply a string and
nothing else.

Regards,
Peter T

"Carim" wrote in message
...
Hi,

In a class module, within a Private Sub ButtonGroup_Click() , I cannot
have the
Application.Evaluate to execute itself ...
I am stuck with these two lines :

Back2Top = "CommandButton" & z & "_Click"
Application.Evaluate (Back2Top)

Thanks a lot for your help
and Happy New Year
Cheers



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Application.Evaluate

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
  #4   Report Post  
Posted to microsoft.public.excel.programming
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



  #5   Report Post  
Posted to microsoft.public.excel.programming
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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Application.Evaluate

Peter,

As a matter of fact, the procedure : Private Sub ButtonGroup_Click()
is located in a class and I am calling it
from the very same userform ...
and in one instance, it has to call itself i.e. a CommandButton Click
will trigger automatically the next
CommandButton Click ...
Should I use your recommendation :
sProc = "CommandButton" & i & "_Click"
CallByName Me, sProc, VbMethod

Thanks again for your precious help
Cheers
Carim
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.Evaluate question lcsma Excel Programming 2 December 12th 08 01:21 PM
evaluate function only in Excel application x taol Excel Programming 1 March 17th 08 09:53 PM
Interpretation of Application.Caller.Parent.Evaluate FARAZ QURESHI Excel Discussion (Misc queries) 1 December 29th 07 07:59 PM
Alternatives to Application.evaluate(Long Formula) Awill Excel Programming 2 April 3rd 07 02:48 AM
Error 2015 with Application.Evaluate Jeff Excel Programming 3 June 6th 06 04:00 PM


All times are GMT +1. The time now is 01:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"