Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 76441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:40:26+00:00 2026-05-10T20:40:26+00:00

In Excel VBA (2003), I’ve noticed that any Public or Friend Sub method in

  • 0

In Excel VBA (2003), I’ve noticed that any Public or Friend Sub method in either a module or ThisWorkbook that doesn’t have any arguments will show up as a Macro that can be run by the user. I.e. when the user goes to Tools –> Macro –> Macros… (or Alt+F8) the method will show up in the list that can be run.

For sanity’s sake (organization, maintenance, etc) I do need to separate the code into modules. I’m hoping to find a non-hacky way to hide some methods from the user, but still allow them to be visible to other code modules. Note that all the code is contained within the same application, so no external code is called.

My current work-around is to use Functions that return a boolean instead of Subs, and just ignore the return value. eJames suggested the option of using an optional argument in the Sub, which will also hide the method from the list of macros.

Neither of these feel quite right, however, so any advice about how to structure a non-trivial Excel VBA application would be much appreciated.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T20:40:27+00:00Added an answer on May 10, 2026 at 8:40 pm

    Add the following to the top of your module:

    Option Private Module 

    From MSDN:

    When a module contains Option Private Module, the public parts, for example, variables, objects, and user-defined types declared at module level, are still available within the project containing the module, but they are not available to other applications or projects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel workbook, which using VBA code that opens another workbook, copies
I'm trying to write an R-Excel vba addin and am having trouble using GetArrayToVBA
How to execute a query in MS Access db from Excel VBA code or
I'm trying to build a VBA form that runs a SQL Server stored procedure
I've got an Excel userform that stores HTML in a textbox, and I'd like
Examples: 2011-01-01 2011-01-01,2011-01-28,2011-12-31 etc. I don't need it to verify that the dates themselves
I have an excel sheet with two columns of interest Year and Donations. The
I have a master excel document with more than 300 worksheets inside. I want
How do I calculate Excel's XIRR function using C#?
I have a workbook where several of my data feeds pass a parameter back

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.