Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I cannot close Excel.application
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00656380
Message ID:
00658284
Views:
27
Frank:

>    *-- Create a reference to an Excel OLE object
>    XLApp = CREATEOBJECT('Excel.Application')
>
>    *-- Create a reference to a workbook
>    oMyXLWorkbook = XLApp.Application.Workbooks.Add
>
>    *-- Create a reference to a worksheet
>    XLSheet      = oMyXLWorkbook.Worksheets.Add
>
>    with xlApp
>        *-- I only need one sheet, so throw away
>        *-- the others
>        .DisplayAlerts = .F.
>        .ActiveWorkBook.Worksheets(3).Delete
>        .ActiveWorkBook.Worksheets(2).Delete


You can simplify your setup code to:
XLApp = CREATEOBJECT("Excel.Application")
XLApp.SheetsInNewWorkbook = 1
XLApp.Visible = .t.
oMyXLWorkbook = XLApp.Workbooks.Add()
...
...
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform