Results 1 to 3 of 3

Thread: Private Sub

  1. #1
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have a few macro's as Private sub's as I do not want them to appear in the Tools > Macro > Macro's drop down. However, it appears that I cannot call a private sub from another private sub. Is there a way around this?

  2. #2
    Bronze Lounger
    Join Date
    Sep 2007
    Posts
    1,203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm guilty of asking, before searching (again).

    A little searching turned up:

    Inside the same module, this should work, but you cannot call a private sub in another module. I would prefer the modules to stay seperated. A suggested workaround is to use "Option Private Module" at the top which gives the same result. I hope not to run into any other issues here.

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post
    [quote name='VegasNath' post='788192' date='09-Aug-2009 18:30']I'm guilty of asking, before searching (again).

    A little searching turned up:

    Inside the same module, this should work, but you cannot call a private sub in another module. I would prefer the modules to stay seperated. A suggested workaround is to use "Option Private Module" at the top which gives the same result. I hope not to run into any other issues here.[/quote]

    To allow procedures to be called from another module yet not appear in the macro list I add an optional argument such as:
    Code:
     Public Sub myProcedure(Optional Abort As Boolean)
    Regards
    Don

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •