+ Reply to Thread
Results 1 to 3 of 3

Calling a Public Subroutine in a Different Workbook

  1. #1
    Raul
    Guest

    Calling a Public Subroutine in a Different Workbook

    I have a public subroutine called routine1() located in in workbook called
    Routines.xls and I would like to call routine1() from another workbook called
    Book1.xls. What is the proper syntax or methodology for doing this? I'm
    missing something.....

    Thanks in advance,
    Raul

  2. #2
    hooksie2@hotmail.com
    Guest

    Re: Calling a Public Subroutine in a Different Workbook

    To run a sub use:
    Application.Run "WorkbookName!MacroName"
    To run a function use:
    ReturnValue = Application.Run("WorkbookName!MacroName")

    You can add any arguments that your functions call after the macro
    name. The relevant xl file will have to be open though.

    Hope that helps,
    Andrew


    Raul wrote:
    > I have a public subroutine called routine1() located in in workbook called
    > Routines.xls and I would like to call routine1() from another workbook called
    > Book1.xls. What is the proper syntax or methodology for doing this? I'm
    > missing something.....
    >
    > Thanks in advance,
    > Raul



  3. #3
    Raul
    Guest

    Re: Calling a Public Subroutine in a Different Workbook

    That did the trick.

    Thank you very much,
    Raul

    "hooksie2@hotmail.com" wrote:

    > To run a sub use:
    > Application.Run "WorkbookName!MacroName"
    > To run a function use:
    > ReturnValue = Application.Run("WorkbookName!MacroName")
    >
    > You can add any arguments that your functions call after the macro
    > name. The relevant xl file will have to be open though.
    >
    > Hope that helps,
    > Andrew
    >
    >
    > Raul wrote:
    > > I have a public subroutine called routine1() located in in workbook called
    > > Routines.xls and I would like to call routine1() from another workbook called
    > > Book1.xls. What is the proper syntax or methodology for doing this? I'm
    > > missing something.....
    > >
    > > Thanks in advance,
    > > Raul

    >
    >


+ 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