Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Automation
Message
De
16/07/1999 19:24:27
 
 
À
16/07/1999 13:26:55
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00242078
Message ID:
00242633
Vues:
28
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform