Public oSheet >oExcel=Createobject("excel.application") >oExcel.DisplayAlerts=.F. >Set Step On >oWorkBook=oExcel.workbooks.Add() >oSheet=oWorkBook.Worksheets(1) >oSheet.PageSetup.Orientation= 1 >With oSheet.PageSetup > .FitToPagesTall=1 > .FitToPagesWide=1 > .CenterHorizontally=.T. > .CenterVertically=.F. > .TopMargin=1*72 > .LeftMargin=.75*72 > .RightMargin=.5*72 > .RightHeader="Page &P of &N" > .LeftHeader="&F" > .RightFooter="Printed on &D" > .FooterMargin=.5*72 > .HeaderMargin=.5*72 >Endwith>
>>oExcel=CREATEOBJECT("excel.application") >>oExcel.DisplayAlerts=.F. >>oWorkBook=oExcel.workbooks.ADD() >>oSheet=oWorkBook.Worksheets(1) >>WITH oSheet.PageSetup >>.Orientation=1 <----------------------------HERE !!!!!!!! >>.FitToPagesTall=1 >>.FitToPagesWide=1 >>.CenterHorizontally=.T. >>.CenterVertically=.F. >>.TopMargin=1*72 >>.LeftMargin=.75*72 >>.RightMargin=.5*72 >>.RightHeader="Page &P of &N" >>.LeftHeader="&F" >>.RightFooter="Printed on &D" >>.FooterMargin=.5*72 >>.HeaderMargin=.5*72 >> >> >>ENDWITH >>>>I assume it times out somehow( running on Terminal Server 2000 )