Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Call To VBA in Another File (97:SR2)

    I know there was a thread on this but how does one call code from another active workbook?

    Thanks,
    John

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Call To VBA in Another File (97:SR2)

    This will run the routine named test in the wrokbook named book1

    <pre>Application.Run "book1.xls!test"</pre>


    Steve

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Call To VBA in Another File (97:SR2)

    Steve,

    Thanks for the tip.

    Keeping with that concept. If "book1.xls!test" were to show a userform on book1.xls, one should be able to change a checkbox to TRUE with another line of code.

    I have tried "UserForm.checkbox1.value = true" but to no avail.

    Any ideas?
    John

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Call To VBA in Another File (97:SR2)

    I don't think you can add it unless the form is open. When the form is open it halts macro processing until the form is closed. You could add this to the form activation (it is added with the userform code, not in a module)

    <pre>Private Sub UserForm_Activate()
    CheckBox1.Value = True
    End Sub</pre>


    Steve

Posting Permissions

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