Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Automation
Message
From
16/07/1999 19:24:27
 
 
To
16/07/1999 13:26:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00242078
Message ID:
00242633
Views:
20
Hi Cetin

I got it finally working. After trying many options I finally concluded that it is the GetObject() function which makes the worksheet hidden. The next code (99.99% yours) works great an fast also.

lcFileName = GetFile('xls')
oExcel= createobject('Excel.application')
with oExcel
.WorkBooks.open(lcFileName)
.Workbooks(1).ActiveSheet.Range("A:D").EntireColumn.AutoFit
.WorkBooks(1).Save
.Quit
endwith


Bu the next one, instead of using CreateObject, in contains a GetObject() keeps the file hidden next time you try to open it.

lcFile = GetFile('xls')
uTMP = GetObject(lcFile)
oXLSApp = uTMP.application
with oXLSApp
.Workbooks(1).ActiveSheet.Range("A:D").EntireColumn.AutoFit
.workbooks(1).Save
.Quit
endwith

If you ever try GetObject and manage to make it work without hiding the worksheet, please let me know. All I got from a debug session was that when you un-hide the worksheet from within Excel, the Saved property changes but I couldn’t notice any other property changed, so it probably changes any other object inside the application, or a property of the application object.

Regards and thanks again

Oscar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform