Call subroutine from another workbook

D

DejaVu

Is it possible to call a subroutine from another workbook?

I have a subroutine called TestSub in my "*Test Book.xls*" workbook.
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 I
-------------------


Is this even possible?

TIA,
DejaV
 
T

Tom Ogilvy

if Test Book.xls is open then

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

Worked for me.
 
D

DejaVu

Thanks Tom - That was exactly what I was looking for. I just couldnt
find the right syntax for it.

DejaVu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top