Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with shutting down Excel after CREATEOBJECT()
Message
De
15/03/2002 16:28:24
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Titre:
Problem with shutting down Excel after CREATEOBJECT()
Divers
Thread ID:
00633617
Message ID:
00633617
Vues:
60
I have a program that I'm working on in VFP 5.0, and have the following code in a prg:

*****************************
x1 = CREATEOBJECT("EXCEL.APPLICATION")
IF TYPE('X1')<>'O'
=MESSAGEBOX('Unable to create an Excel application!',16,'Save to Excel Aborted')
oApp.lExitAll = .T.
RETURN .F.
ENDIF
x1.Workbooks.Open(tcTemplate)

lcSheet = SUBSTR(tcTemplate, 1, AT(".",TCTEMPLATE)-1) + "1"
lcSheet = SUBSTR(lcSheet, RAT("\", lcSheet) + 1)

x1.Workbooks.Open(oapp.lctemp+'xtab1.xls')
x1.Sheets("xtab1").Name = "Legend"
LNROWS = INT(VAL(SUBSTR(x1.Selection.SpecialCells(11).Address, 4)))

...etc. (lots of other formatting calls to Excel)....

Then I end with:

x1.ActiveWorkbook.Keywords = "IPC"
x1.ActiveWorkbook.Comments = ""
x1.activeworkbook.saveas(lsaveas)
x1.Visible = .t.
******************************


That part of my code is working fine. My problem is when my users close Excel but leave the Fox application running and attempt to open any *.xls via Start, Documents or if they open a specific spreadsheet (*.xls) from Windows Explorer, they only see the Excel title bar, the menu bar and the toolbars -- no spreadsheet. It's as if it's translucent. If I look at my task manager, it says that Excel is running and the spreadsheet I selected is open, but I can't view it. The only way I can get Excel to look right is to shut down my Fox application, then start Excel by opening the spreadsheet.

Another point of interest: If I launch Excel from my Fox app then close Excel and leave my Fox app running, then start Excel via excel.exe instead of via the spreadsheet, it works fine.

It's almost like Fox doesn't really let go of Excel until I close the Fox app. Should I be using another function besides CREATEOBJECT()? Is it doing something I should be aware of?

Any ideas would be greatly appreciated...

Thanks,

Joe
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform