+ Reply to Thread
Results 1 to 3 of 3

Passing Arguments to PRIVATE Procedures

  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:
    Please Login or Register  to view this content.
    And this works perfectly.

    However, I would now like to pass a variable to the ClearEnteredHoursOnHrsBased routine. Something to the effect of:
    Please Login or Register  to view this content.
    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:
    Please Login or Register  to view this content.
    So - how do you pass arguments to private routines?


    UPDATE: and everything works just fine if I remove the "PRIVATE" and just use:
    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Passing Arguments to PRIVATE Procedures

    To pass arguments using Application.Run you list them after the sub name.

    For example.
    Please Login or Register  to view this content.
    However
    Last edited by Norie; 12-24-2014 at 10:36 AM.
    If posting code please use code tags, see here.

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

    Re: Passing Arguments to PRIVATE Procedures

    Thank you!

+ Reply to Thread

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