Results 1 to 4 of 4

Thread: EXCEL: How To: Pass Workbook Handle to Sub [RESOLVED - duh]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Resolved EXCEL: How To: Pass Workbook Handle to Sub [RESOLVED - duh]

    Esteemed Forum Participants and Lurkers:
    ===============================
    Excel 2003 VBA

    I must be doing something dumb here ... I can't seem to pass a workbook reference to a Subroutine ...
    Code:
    Sub aTest()
        Dim aBook As Workbook
        
        Set aBook = ActiveWorkbook  'Set a handle to a WorkBook
        Debug.Print aBook.Name      'Prove that we can access by handle
        Pass_Book (aBook)           '<< THIS FAILS
    End Sub
    
    Sub Pass_Book(TestBook As Workbook)
        Debug.Print TestBook.Name, TestBook.Sheets(1).Name
    End Sub
    I get an error when I call "Pass_Book":

    Run-time error '438': Object doesn't support this property or method

    Thank you for any and all comments, suggestions, and assistance.
    Last edited by Webtest; Oct 26th, 2005 at 03:13 PM.
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

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