Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Displaying the Sub or Function Name

Is there anyway of displaying the current sub or function name that is
running?

Something like:

Sub DisplaySubName()
MsgBox ThisSub.Name
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Displaying the Sub or Function Name

hi
you can use the status bar.
when writing the sub, you know the name of the sub your are writing.
at the beginning of the sub add this like
application.statusbar = "sub now running = mysub"
at the end of the sub ad this line
application.statusbar = False

the name of the sub will appear in the lower left on the status bar.

Regards
FSt1

"FunkySquid" wrote:

Is there anyway of displaying the current sub or function name that is
running?

Something like:

Sub DisplaySubName()
MsgBox ThisSub.Name
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Displaying the Sub or Function Name

that's cool. is there any way to have the macro pull out the name
automatically without hard coding it?
just wondering.
:)
susan


On May 29, 2:15*pm, FSt1 wrote:
hi
you can use the status bar.
when writing the sub, you know the name of the sub your are writing.
at the beginning of the sub add this like
application.statusbar = "sub now running = mysub"
at the end of the sub ad this line
application.statusbar = False

the name of the sub will appear in the lower left on the status bar.

Regards
FSt1



"FunkySquid" wrote:
Is there anyway of displaying the current sub or function name that is
running?


Something like:


Sub DisplaySubName()
* MsgBox ThisSub.Name
End Sub- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Displaying the Sub or Function Name

hi
I don't think you can while the code is running because you have to run code
to to find the sub name and since you can't run 2 sub at the same time you
would have to incorperated the "find" code into the running sub. and if
using a message box, that would stop code from running while the message box
was up since the message box is modal. best just to use the status bar

Regards
FSt1

"Susan" wrote:

that's cool. is there any way to have the macro pull out the name
automatically without hard coding it?
just wondering.
:)
susan


On May 29, 2:15 pm, FSt1 wrote:
hi
you can use the status bar.
when writing the sub, you know the name of the sub your are writing.
at the beginning of the sub add this like
application.statusbar = "sub now running = mysub"
at the end of the sub ad this line
application.statusbar = False

the name of the sub will appear in the lower left on the status bar.

Regards
FSt1



"FunkySquid" wrote:
Is there anyway of displaying the current sub or function name that is
running?


Something like:


Sub DisplaySubName()
MsgBox ThisSub.Name
End Sub- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Displaying the Sub or Function Name

yes, i see.
i tend to have one "overview" sub (like a userform sub) that calls all
my sub-subs (for lack of a better term) & i could put it in there
before calling each of them (& afterwards). such as:

sub commandbutton1_click()
application.statusbar = "sub now running = find_terms"
Call find_terms
application.statusbar = false
application.statusbar = "sub now running = insert_data"
Call insert_data
application.statusbar = false
end sub

thanks for the info.
:)
susan


On May 29, 2:55*pm, FSt1 wrote:
hi
I don't think you can while the code is running because you have to run code
to to find the sub name and since you can't run 2 sub at the same time you
would have to incorperated the "find" code into the running sub. *and if
using a message box, that would stop code from running while the message box
was up since the message box is modal. best just to use the status bar

Regards
FSt1



"Susan" wrote:
that's cool. *is there any way to have the macro pull out the name
automatically without hard coding it?
just wondering.
:)
susan


On May 29, 2:15 pm, FSt1 wrote:
hi
you can use the status bar.
when writing the sub, you know the name of the sub your are writing.
at the beginning of the sub add this like
application.statusbar = "sub now running = mysub"
at the end of the sub ad this line
application.statusbar = False


the name of the sub will appear in the lower left on the status bar.


Regards
FSt1


"FunkySquid" wrote:
Is there anyway of displaying the current sub or function name that is
running?


Something like:


Sub DisplaySubName()
* MsgBox ThisSub.Name
End Sub- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Displaying the Sub or Function Name

looks like you got ahold of that handle pretty good. that should work nicely
for you.

Regards
FSt1

"Susan" wrote:

yes, i see.
i tend to have one "overview" sub (like a userform sub) that calls all
my sub-subs (for lack of a better term) & i could put it in there
before calling each of them (& afterwards). such as:

sub commandbutton1_click()
application.statusbar = "sub now running = find_terms"
Call find_terms
application.statusbar = false
application.statusbar = "sub now running = insert_data"
Call insert_data
application.statusbar = false
end sub

thanks for the info.
:)
susan


On May 29, 2:55 pm, FSt1 wrote:
hi
I don't think you can while the code is running because you have to run code
to to find the sub name and since you can't run 2 sub at the same time you
would have to incorperated the "find" code into the running sub. and if
using a message box, that would stop code from running while the message box
was up since the message box is modal. best just to use the status bar

Regards
FSt1



"Susan" wrote:
that's cool. is there any way to have the macro pull out the name
automatically without hard coding it?
just wondering.
:)
susan


On May 29, 2:15 pm, FSt1 wrote:
hi
you can use the status bar.
when writing the sub, you know the name of the sub your are writing.
at the beginning of the sub add this like
application.statusbar = "sub now running = mysub"
at the end of the sub ad this line
application.statusbar = False


the name of the sub will appear in the lower left on the status bar.


Regards
FSt1


"FunkySquid" wrote:
Is there anyway of displaying the current sub or function name that is
running?


Something like:


Sub DisplaySubName()
MsgBox ThisSub.Name
End Sub- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



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
count function not working, keeps displaying 0 dnm Excel Worksheet Functions 5 April 3rd 23 07:32 PM
eval of concatenate function not displaying results tony12345 Excel Discussion (Misc queries) 1 March 6th 09 05:25 PM
Match function and displaying results Dan Excel Programming 3 August 21st 06 09:49 PM
The left function does not work when displaying times, how is thi. Nambo27 Excel Worksheet Functions 3 February 25th 05 06:46 PM
Displaying value of specific cell within a range, with IF function...? Steve Excel Discussion (Misc queries) 1 January 14th 05 02:23 AM


All times are GMT +1. The time now is 05:08 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"