Results 1 to 3 of 3

Thread: [RESOLVED] Run Sub created in Form1 from Form2

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2009
    Posts
    18

    Resolved [RESOLVED] Run Sub created in Form1 from Form2

    I am in the process of creating an excel add-in.
    I have created a subroutine inside one form. Using a second form, I would like to run the subrountine if the "OK" button is clicked.
    How do I make this public subroutine availiable between forms?

    Sorry if this is a stupid question. I am new at this and I have been given this project with very little instruction. Trial by fire.

    Thanks,
    snjdev

  2. #2
    Addicted Member AnthonyGrimes's Avatar
    Join Date
    Sep 2008
    Location
    United States
    Posts
    131

    Re: Run Sub created in Form1 from Form2

    You could put the subroutine in a module.

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Run Sub created in Form1 from Form2

    If the routine is declared public, and the instance of the form with the routine is within scope of the form that calls the routine (that's a BIG if), then the call would be:

    <instance of form>.<method name>

    as would be the case for any other public member of any other class. Forms are just classes.
    My usual boring signature: Nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width