Excel 2007 PrintPreview

B

brian

Excel 97-2003 PrintPreview works - 2007 Excel does not

1. This code has worked for Excel 97-2003
2. The author of the code is not available
3. Do not get consistent results
3.A. User running Excel: Subscript out-of-range
3.B. User running Excel: Print, Next, Previous, Close grayed out but
Pages 1-7 indicator in left corner
* This has happened with Office SP1
3.C. Using the VBA IDE in Debug Mode shows a subscript index
out-of-range on the Split function

* Each sheet contains a chart

Code:

Sub Report_View()
Dim Page2 As String
Dim SplitToken As Variant
Dim SheetName As String

If Sheets("RawData").Range("A1") <> "HEADER" Then
MsgBox "Please select a Test File first!"
Else
'Sheets("Parameters").Range("C10") = "SI"
'Calculate
Application.Calculate

usrMain.Hide

'Select the correct pages and do a print preview:
Select Case Sheets("Cu").Range("G2") / 6
Case Is <= 1
Page2 = "OverallReport_Page2-1"
Case Is <= 2
Page2 = "OverallReport_Page2-1,OverallReport_Page2-2"
Case Is <= 3
Page2 =
"OverallReport_Page2-1,OverallReport_Page2-2,OverallReport_Page2-3"
Case Is <= 4
Page2
"OverallReport_Page2-1,OverallReport_Page2-2,OverallReport_Page2-3,OverallReport_Page2-4"
Case Else
Page2
"OverallReport_Page2-1,OverallReport_Page2-2,OverallReport_Page2-3,OverallReport_Page2-4,OverallReport_Page2-5"
End Select


Sheets(Split("OverallReport,NetDP_vs_T,Eff_T_Plot,Eff_Avg_Plot,Eff_Avg_LogPlot,"
& Page2, ",", -1, 1)).Select
ActiveWindow.SelectedSheets.PrintPreview

Sheets("Home").Select
usrMain.Show
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top