How to adjust column width when export to Excel?  
Author Message
ykc





PostPosted: Visual FoxPro General, How to adjust column width when export to Excel? Top

I hv created some table and want to save it as Excel

I used "export to <filename> type xls" to do the job

I find that the result table column width is too narrw that

it can't display the contant

can I adjust the column width when export to excel

how can I do that



Visual FoxPro2  
 
 
CetinBasoz





PostPosted: Visual FoxPro General, How to adjust column width when export to Excel? Top

with just export command you can't. You need to do some automation. ie:

lcXLS = fullpath("yourxlsfile.xls")
oExcel = createobject("Excel.Application")
with oExcel
.DisplayAlerts = .f.
.Workbooks.Open( m.lcXLS )
.Activeworkbook.ActiveSheet.UsedRange.Columns.Autofit()
.ActiveWorkbook.SaveAs(m.lcXLS, -4143) && xlWorkbooknormal = -4143
.ActiveWorkbook.Saved = .t.
.Quit
endwith