![]() |
Print Preview hangs
Hi all
When I run this code: Dim MWB As Workbook Dim Sht As Worksheet Set MWB = Workbooks.Open("c:\Development\AtRisk Excel Project\MigrationReport.xls") Set Sht = MWB.Sheets("FirstMigration") Sht.PrintPreview The preview opens behind my VBA form, but then everything hangs. I have to use task manager to terminate excel. Printing without previewing works fine. OS is Windows 2000. Any idreas? |
Print Preview hangs
James,
You need to Hide the userform prior to calling PrintPreview, and the Show the form when PrintPreview returns. E.g., Set Sht = MWB.Sheets("FirstMigration") Me.Hide '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Sht.PrintPreview Me.Show ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com "James Cooke" wrote in message ... Hi all When I run this code: Dim MWB As Workbook Dim Sht As Worksheet Set MWB = Workbooks.Open("c:\Development\AtRisk Excel Project\MigrationReport.xls") Set Sht = MWB.Sheets("FirstMigration") Sht.PrintPreview The preview opens behind my VBA form, but then everything hangs. I have to use task manager to terminate excel. Printing without previewing works fine. OS is Windows 2000. Any idreas? |
Print Preview hangs
Thank you Chip, this works.
james "Chip Pearson" wrote in message ... James, You need to Hide the userform prior to calling PrintPreview, and the Show the form when PrintPreview returns. E.g., Set Sht = MWB.Sheets("FirstMigration") Me.Hide '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Sht.PrintPreview Me.Show ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com "James Cooke" wrote in message ... Hi all When I run this code: Dim MWB As Workbook Dim Sht As Worksheet Set MWB = Workbooks.Open("c:\Development\AtRisk Excel Project\MigrationReport.xls") Set Sht = MWB.Sheets("FirstMigration") Sht.PrintPreview The preview opens behind my VBA form, but then everything hangs. I have to use task manager to terminate excel. Printing without previewing works fine. OS is Windows 2000. Any idreas? |
All times are GMT +1. The time now is 01:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com