Hi
I'm creating Excel File Dashboard from MS Access VBA and trying to setup the page size to A3 using below code:
While setting up the page size to A4 I'm getting error if printer is not installed. I want to set the page size to A3 whether printer is not installed because Excel Dashboard is generated in Network drive and from there user will print the dashboard.
Any idea how to set the page size to A3 without installing the printer.
I'm creating Excel File Dashboard from MS Access VBA and trying to setup the page size to A3 using below code:
Code:
Sub SetUpPage(ws As Worksheet, Heading As String, Orient As String)
On Error GoTo ErrHand
Dim myOrient As String
ws.Application.ScreenUpdating = False
With ws
With .PageSetup
.LeftHeader = ""
.CenterHeader = "&""Bookman Old Style,Bold""&14&K09-024&U" & Heading & " (" & gsReportingWeekNm & ")"
.RightHeader = "Page &P of &N"
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = ws.Application.InchesToPoints(0.25)
.RightMargin = ws.Application.InchesToPoints(0.25)
.TopMargin = ws.Application.InchesToPoints(0.5)
.BottomMargin = ws.Application.InchesToPoints(0.25)
.HeaderMargin = ws.Application.InchesToPoints(0.25)
.FooterMargin = ws.Application.InchesToPoints(0.25)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = Excel.xlPrintNoComments
.CenterHorizontally = True
.CenterVertically = False
If Orient = "P" Then myOrient = Excel.xlPortrait Else If Orient = "L" Then myOrient = Excel.xlLandscape
.Orientation = myOrient
.Draft = False
.PaperSize = Excel.xlPaperA3 '----> Error
.FirstPageNumber = Excel.xlAutomatic
.Order = Excel.xlDownThenOver
.BlackAndWhite = False
End With
End With
ws.Application.ScreenUpdating = True
ExitSub:
Exit Sub
ErrHand:
Resume ExitSub
End Sub
While setting up the page size to A4 I'm getting error if printer is not installed. I want to set the page size to A3 whether printer is not installed because Excel Dashboard is generated in Network drive and from there user will print the dashboard.
Any idea how to set the page size to A3 without installing the printer.