ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling Procedures (https://www.excelbanter.com/excel-programming/293429-calling-procedures.html)

jrh

Calling Procedures
 
I have a title for a procedure which is the title I want
someone to see when they go to Tools-Macro and pick a
macro to run. This procedure calls a couple of procedures
written below it in the module. I don't want these
procedure names to be choices when someone goes to Tools-
Macro. Do I have to name these other procedures

something different so they are called by that one
procedure but are not choices to run on their own?

thank you.

Frank Kabel

Calling Procedures
 
Hi use the declaration
Private sub foo()
' your code
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

jrh wrote:
I have a title for a procedure which is the title I want
someone to see when they go to Tools-Macro and pick a
macro to run. This procedure calls a couple of procedures
written below it in the module. I don't want these
procedure names to be choices when someone goes to Tools-
Macro. Do I have to name these other procedures

something different so they are called by that one
procedure but are not choices to run on their own?

thank you.


Chip Pearson

Calling Procedures
 
One way is to declare the procedure as Private. E.g.,

Private Sub TheSubName()
' your code here
End Sub

The disadvantage of this is that the procedure can be called only
by procedures in the same module.

Another way is to make the procedure a Function instead of a Sub
procedure.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"jrh" wrote in message
...
I have a title for a procedure which is the title I want
someone to see when they go to Tools-Macro and pick a
macro to run. This procedure calls a couple of procedures
written below it in the module. I don't want these
procedure names to be choices when someone goes to Tools-
Macro. Do I have to name these other procedures

something different so they are called by that one
procedure but are not choices to run on their own?

thank you.





All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com