>I made a little automation program to adjust column widths properties. This is the Code.
>
>uTMP = GetObject('ResulQAS12.XLS')
>oXLSApp = uTMP.application
>
>oXLHoja = oXLSApp.workbooks(1).WorkSheets(1)
>
>oXLHoja.Columns("A:A").EntireColumn.AutoFit
>oXLHoja.Columns("B:B").EntireColumn.AutoFit
>oXLHoja.Columns("C:C").EntireColumn.AutoFit
>oXLHoja.Columns("D:D").EntireColumn.AutoFit
>
>oXLSApp.workbooks(1).Save
>oXLSApp.workbooks(1).Close
>
>My problems is that it is now endlessly invisible, If I open it from Excel I can see the Ready prompt at the status bar. I’m sure it is open because when I try to open again the same file I receive the ‘Read Only’ warning. Excel does not show any signs of having this file opened.
>
>Any tips to solve my problem and improve this code are welcome.
>
>Regards
>
>Oscar
uTMP = GetObject('ResulQAS12.XLS')
oXLSApp = createobject("Excel.application")
with oExcel
.workbooks.open('ResulQAS12.XLS')
.ActiveSheet.Range("A:D").EntireColumn.AutoFit
.ActiveWorkbook.Save
.Quit
endwith
If columns weren't adjacent then you could use either :
Range("A:A","F:F","P:Z") (if not coding internationally) or oExcel.Application.Union(.Range("A:A"),.range("F:F"),.range("P:Z"))
Cetin