Aarvee
Well-known member
In my application I use the output of my report to Excel and printing through the same. As part of the reporting I show a print preview. I have reproduced the code below. The problem is that I am unable to use the scaling option( in Excel) in Page setup through which by setting the report to 1 page wide by x pages tall you can get the data fit the way you want. If anyone can help it would be nice.
Ws.Range("A1:" & cw & "").Select()
If ReportPaper = "A4" Then
Ws.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperA4
ElseIf ReportPaper = "A3" Then
Ws.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperA3
Else
Ws.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperA4
End If
If ReportOrientation = "P" Then
Ws.PageSetup.Orientation = Excel.XlPageOrientation.xlPortrait
Ws.PageSetup.FitToPagesWide = 1
Ws.PageSetup.FitToPagesTall = 1
Else
Ws.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape
Ws.PageSetup.FitToPagesWide = 1
End If
In the above code obviously ws is the excel object. The code does go through the required lines in the debug mode. But the page setup does not give me the desired result.
Thanks a lot
Varadarajan R
Ws.Range("A1:" & cw & "").Select()
If ReportPaper = "A4" Then
Ws.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperA4
ElseIf ReportPaper = "A3" Then
Ws.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperA3
Else
Ws.PageSetup.PaperSize = Excel.XlPaperSize.xlPaperA4
End If
If ReportOrientation = "P" Then
Ws.PageSetup.Orientation = Excel.XlPageOrientation.xlPortrait
Ws.PageSetup.FitToPagesWide = 1
Ws.PageSetup.FitToPagesTall = 1
Else
Ws.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape
Ws.PageSetup.FitToPagesWide = 1
End If
In the above code obviously ws is the excel object. The code does go through the required lines in the debug mode. But the page setup does not give me the desired result.
Thanks a lot
Varadarajan R