Results 1 to 9 of 9

Thread: Excel: workbooks.open doesn't work (not a newbie problem)

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    3

    Resolved Excel: workbooks.open doesn't work (not a newbie problem)

    This one is small enough to try out on your own machine.


    Book1 has this event procedure in the ThisWorkbook object:
    VB Code:
    1. Private Sub Workbook_BeforePrint(Cancel As Boolean)
    2.     Workbooks.Open "SomeWorkbook"
    3.     MsgBox "foo"
    4. End Sub
    Book2 has this sub in a code module:
    VB Code:
    1. Sub test()
    2.     Dim wb As Workbook
    3.     Set wb = Workbooks.Open("Book1.xls")
    4.     wb.PrintOut
    5. End Sub
    When I run test() in Book2, Book1 opens, msgboxes the 'foo' and prints, but the Workbooks.Open "SomeWorkbook" line doesn't do anything. Is there any way to make it work? Maybe the Workbooks.Open calls can't be nested, but I can't find any indication of this in documentation. Thanks for you help.

    Will
    Last edited by tranner; Jun 9th, 2005 at 01:17 PM.

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