>oleApp = CreateObject("Excel.Application") >OleApp.Visible = .T. >OleApp.WorkBooks.Add >msheet = "Sheet1" >OleApp.Sheets(msheet).Select >OleApp.Sheets(msheet).PrintPreview >>This code will open excel, create a new sheet and also attempt to do a print preview and give me the lines on the screen to show the boundries of the print page, but it defaults to portrait.
*-- set pageSetup properties WITH oXLS.Application.ActiveSheet.PageSetup *.LeftHeader = "" .CenterHeader = lcTableName *.RightHeader = "" .LeftFooter = icMessageBoxCaption .CenterFooter = "&P of &N" .RightFooter = "&D - &T" .LeftMargin = cnCentimetersToPoints * 1.9 .RightMargin = cnInchesToPoints * 0.27244094488189 .TopMargin = cnInchesToPoints * 0.47244094488189 .BottomMargin = cnInchesToPoints * 0.47244094488189 .HeaderMargin = cnInchesToPoints * 0.236220472440945 .FooterMargin = cnInchesToPoints * 0.236220472440945 *.PrintHeadings = .f. *.PrintGridlines = .f. *.PrintComments = xlPrintNoComments *.PrintQuality = 600 *.CenterHorizontally = .t. *.CenterVertically = .t. .Orientation = xlLandscape *.Draft = .f. *.PaperSize = xlPaperA4 *.FirstPageNumber = xlAutomatic *.Order = xlDownThenOver *.BlackAndWhite = .f. .Zoom = .f. .FitToPagesWide = 1 .FitToPagesTall = .f. .PrintTitleRows = "$1:$1" && repeats header on each page ENDWITH