![]() |
VBA error 1004
Tasha,
In this situation, PrintPreview requires an array. This does the trick: Sub PreviewSheets() Dim myArray() Dim selCount With ActiveWindow selCount = .SelectedSheets.Count - 1 ReDim myArray(selCount) For t = 0 To selCount myArray(t) = .SelectedSheets(t + 1).Name Next ActiveWorkbook.Sheets(myArray).PrintPreview End With End Sub Stan Scott New York City "Tasha" wrote in message ... I have a macro that should show the selected sheet(s) in print preview. The macro is Sub Print_Click ActiveWindow.SelectedSheets.PrintPreview End sub The spread sheet that contains this macro is posted on our company intranet. When I click on the button on the spreadsheet from my hard drive there is no problem. When I click on it from the intranet I get Error 1004 method 'PrintPreview' not recognized for objects 'Sheets'. The PrintOut method works either on my hard drive or on the intranet but for some reason the PrintPreview does not. Any suggestions? TIA Tasha |
All times are GMT +1. The time now is 05:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com