Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Automation
Message
From
16/07/1999 02:34:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
15/07/1999 19:38:44
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00242078
Message ID:
00242163
Views:
22
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform