+ Reply to Thread
Results 1 to 3 of 3

UserForm Procedures with Arguments?

  1. #1
    Registered User
    Join Date
    03-31-2009
    Location
    Auburn Alabama
    MS-Off Ver
    Microsoft Office Excel 2007 (Windows)
    Posts
    99

    UserForm Procedures with Arguments?

    Hello,

    My question is about passing arguments to UserForm procedures.

    I've created a Main procedure. Main calls a sub procedure and returns an array. Obviously Main can now use the array.

    But then Main calls a sub procedure to open my userform.

    All of my userform sub procedures need to use the array I created in Main. Do I have to pass the array into all of my userform procedures? Into the UserForm_Show procedure? And then again into UserForm_Initialize? And then again into ComboBox_Change?

    How would I do this?

    I don't understand how to give my UserForm procedures the array from my Main procedure.

    Thanks for any and all help!
    Last edited by CrazyFileMaker; 06-01-2009 at 04:44 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: UserForm Procedures with Arguments?

    Hello CrazyFileMaker,

    Declare your array as Public in the General procedure section of the Main Module. This will retain the values as long as Excel is running and be available to all other modules in your VBA project, including UserForms.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-31-2009
    Location
    Auburn Alabama
    MS-Off Ver
    Microsoft Office Excel 2007 (Windows)
    Posts
    99

    Re: UserForm Procedures with Arguments?

    Thanks Leith!

    That helps me a lot!

    Cheers!

+ Reply to Thread

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