With Worksheets("sheet1") .PageSetup.Orientation = xlLandscape .PrintOut End WithThe With statement makes it easier and faster to set several properties at the same time. The following example sets all the margins for worksheet one.
With Worksheets(1).PageSetup .LeftMargin = Application.InchesToPoints(0.5) .RightMargin = Application.InchesToPoints(0.75) .TopMargin = Application.InchesToPoints(1.5) .BottomMargin = Application.InchesToPoints(1) .HeaderMargin = Application.InchesToPoints(0.5) .FooterMargin = Application.InchesToPoints(0.5) End WithConverting this to VFP code is near starightforward :
With Worksheets("sheet1") * Becomes with oExcel with .Worksheets("sheet1") ... with .WorkSheets(1).PageSetup .LeftMargin = .Application.InchesToPoints(0.5) ....Cetin