Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Private and Public subs 2

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
Just out of curiousity, is there anyway I can declare a sub public, but not be able to have users access it from the macro window, basically i want a workbook to have 2 modules, one with regular subs and one with public subs, but i dont want the names of the public subs showing up when they go to the macro window to pick one of the macros from the other module, thanks!
 
Just define a parameter for the sub (whether you need it or not.) Excel only includes public subs with no parameters when displaying macros for user selection (Alt-F8)
 
Zathras,
I sort of know what you're talking about, but I'm not sure how to achieve it. Perhaps you can further elaborate? Thanks
 
[blue]
Code:
Option Explicit

Sub Test()
  Demo1
  Demo2
End Sub

Sub Demo1()
  MsgBox "Demo1: This sub is a macro."
End Sub

Sub Demo2(Optional AParm As Integer = 0)
  MsgBox "Demo2: This sub is NOT a macro"
End Sub
[/color]

Demo1 shows up in the macro list (along with "Test"), Demo2 does not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top