Results 1 to 3 of 3

Passing Arguments to PRIVATE Procedures

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Question Passing Arguments to PRIVATE Procedures

    I apologize if this is not clear.

    I have two Modules. One called modFeeBasis and one called modWorksheetHoursBased. Located with each module are various sub routines (procedures). In modWorksheetHoursBased, I have a sub called ClearEnteredHoursOnHrsBased. In modFeeBasis, I have a sub called cmdButtonHoursBased.

    I typically keep all my routines as "PRIVATE" so that they are not accessible to the user to call through the view macro window. And I have learned that the way to call a private sub that exists in another module is through the "APPLICATION.RUN" command. So if I wanted to call ClearEnteredHoursOnHrsBased from the cmdButtonHoursBased routine, my code shall read:
    Application.Run "ClearEnteredHoursOnHrsBased"
    And this works perfectly.

    However, I would now like to pass a variable to the ClearEnteredHoursOnHrsBased routine. Something to the effect of:
    Private Sub ClearEnteredHoursOnHrsBased(FromRadioButton As Boolean)
    However, back at the cmdButtonHoursBased routine, I do not know how to pass the FromRadioButton argument from with the application.run command. The following doesnt work:
    Application.Run "ClearEnteredHoursOnHrsBased(False)"
    So - how do you pass arguments to private routines?


    UPDATE: and everything works just fine if I remove the "PRIVATE" and just use:
    ClearEnteredHoursOnHrsBased (True)
    So I must be doing something right....but since I removed the PRIVATE, the routine is now accessible to the user from the View Macros window, which I dont want.
    Last edited by clemsoncooz; 12-24-2014 at 09:28 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Executing procedures with multiple arguments
    By ferfer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-21-2012, 03:40 AM
  2. Passing variable value from Private Sub to Module
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2009, 08:38 AM
  3. UserForm Procedures with Arguments?
    By CrazyFileMaker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2009, 02:09 AM
  4. Passing a private variable to another module
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-26-2008, 02:26 PM
  5. [SOLVED] Passing Variables Between Procedures
    By Arturo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2005, 10:06 PM

Tags for this Thread

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