+ Reply to Thread
Results 1 to 3 of 3

Call subroutine from another workbook

  1. #1
    Registered User
    Join Date
    04-25-2005
    Posts
    99

    Call subroutine from another workbook

    Is it possible to call a subroutine from another workbook?

    I have a subroutine called TestSub in my "Test Book.xls" workbook. I open this book, then try to call subroutine (TestSub) in that book.
    Please Login or Register  to view this content.
    Is this even possible?

    TIA,
    DejaVu

  2. #2
    Tom Ogilvy
    Guest

    Re: Call subroutine from another workbook

    if Test Book.xls is open then

    Sub RunTestsub()
    Application.Run "'Test Book.xls'!TestSub"
    End Sub

    Worked for me.


    --
    Regards,
    Tom Ogilvy


    "DejaVu" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Is it possible to call a subroutine from another workbook?
    >
    > I have a subroutine called TestSub in my "*Test Book.xls*" workbook. I
    > open this book, then try to call subroutine (-TestSub-) in that book.
    >
    > Code:
    > --------------------
    > If frmDate.chkATime Then
    > Set wb = Workbooks("Test Book.xls")
    > If wb = Nothing Then
    > Workbooks.Open "C:\Test Folder\Test Book.xls", False, True
    > End If
    > Call TestSub
    > Workbooks("Test Book.xls").Close False
    > End If
    > --------------------
    >
    >
    > Is this even possible?
    >
    > TIA,
    > DejaVu
    >
    >
    > --
    > DejaVu
    > ------------------------------------------------------------------------
    > DejaVu's Profile:

    http://www.excelforum.com/member.php...o&userid=22629
    > View this thread: http://www.excelforum.com/showthread...hreadid=481877
    >




  3. #3
    Registered User
    Join Date
    04-25-2005
    Posts
    99
    Thanks Tom - That was exactly what I was looking for. I just couldnt find the right syntax for it.

    DejaVu

+ 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