Results 1 to 12 of 12

Option Private Module/code organisation

Threaded View

  1. #1
    Registered User
    Join Date
    01-03-2012
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    29

    Option Private Module/code organisation

    Hello, I had no idea how to write a good title for this problem.

    I have a workbook with many different sheets with different macros needed in each sheet.
    Sometimes a sheet is used as a template - VeryHidden and copied when needed.
    Not knowing any better I put my code specific to each sheet in: VBAProject\Microsoft Excel Objects\Sheet...\"View Code" and it worked.

    Now I would like a macro from one sheet to call a procedure in another sheet.
    Which is easy if that procedure is "Public":
    Call Worksheets("Sheet1").testProcedure
    But then that procedure is Public which I do not want (User can try to run it directly from Excel.

    I found that I should use "Option Private Module" which works in "VBAProject\Modules".
    But in Excel objects I get a compile error "Option Private Module not permitted in an object module". And I am stuck.

    I have two problems:
    1. Can it work the way I want it to (a Public procedure in object module not seen by the user)
    2. Is my concept of organizing macros, code is wrong? Are there any tips/tutorials telling how to do it?
    Last edited by Gzdnkh; 06-18-2013 at 04:23 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1