Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using OleServer
Message
From
11/06/1999 14:01:00
 
 
To
11/06/1999 13:51:07
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00228894
Message ID:
00228900
Views:
14
It's been a while since I did this but here is some code from one of my classes.
One difference I see is that I have .SaveAs as a method of ActiveWorkBook instead of the application object.

To terminate a process after my code bombed, I go to task manager and end it there.

LPARAMETERS CompletePathAndFileNameWithExtension
*!* If the file specified already exists Excel gives a dialog
*!* asking "Do you want to overwrite". I can't respond programatically
*!* so I'm going to emulate that behavior here
m.Response = 0
IF FILE(CompletePathAndFileNameWithExtension)
m.Response = MESSAGEBOX("File already exists, do you wish to overwrite?", 20 )
ENDIF

IF m.Response = 6 &&User says ok to overwrite
ERASE (CompletePathAndFileNameWithExtension)
ENDIF
this.oExcel.activeworkbook.saveas(CompletePathAndFileNameWithExtension)

Hope this helps.

>We are using OLEServer to create Excel Workbooks from VFP 6.0. We can create the workbook, add values, format it, and so on. But we cannot figure out how to use the SaveAs() function, because VFP does not support named arguments. Here is sample code:
>
>oWorkbook = createobject("Excel.Application")
>with oWookbook
> .WorkBooks.Add
> .Sheets("Sheet1").Name = "Count"
> .Cells(1,1).Value = 'Name'
> .Cells(1,2).Value = 'Product'
> .Cells(1,3).Value = 'Count'
> .SaveAs('C:\INV.XLS') && < OLE Error here
> .Close
>endwith=09
>release oWorkbook
>
>What are we doing wrong?
>
>Also, each time we run this program is starts up another Excel process. How do we terminate a process?
>
>Any help would be greatly appreciated.
>
>Michele Pace
>Areté Inc.
>arete@areteinc.com
Previous
Reply
Map
View

Click here to load this message in the networking platform