I am creating an Excel worksheet for users and need to set the printing properties in code.
The problem I have is trying to find the correct property settings to "fit all columns across one page."
' Highlight the full range used on sheet and set print area and printing properties
' objRange1 = .Range(.Cells(#1st Row, #1st Col), .Cells(#Rows, #Last Col))
objRange1 = .Range(.Cells(1, 1), .Cells(intSpreadsheetRow, 8))
.PrintArea = objRange1.Address
.LeftHeader = ""
.CenterHeader = "Un-Allocated Sales Order Lines with Free Stock"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "Page &P of &N"
.RightFooter = ""
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = Excel.XlPrintLocation.xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = Excel.XlPageOrientation.xlLandscape
.Draft = False
.PaperSize = Excel.XlPaperSize.xlPaperA4
.FirstPageNumber = Excel.Constants.xlAutomatic
.Order = Excel.XlOrder.xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
'.FitToPagesTall = 0
.PrintErrors = Excel.XlPrintErrors.xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True