This one is small enough to try out on your own machine.
Book1 has this event procedure in the ThisWorkbook object:
Book2 has this sub in a code module:VB Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean) Workbooks.Open "SomeWorkbook" MsgBox "foo" 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.VB Code:
Sub test() Dim wb As Workbook Set wb = Workbooks.Open("Book1.xls") wb.PrintOut End Sub
Will




Reply With Quote