How to create an Excel .csv

Post Reply
User avatar
Rick Lipkin
Posts: 2668
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

How to create an Excel .csv

Post by Rick Lipkin »

To All

Does anyone have an example on how to create an Excel .csv comma delimited useing TOleAuto() ??

Many Thanks
Rick Lipkin
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: How to create an Excel .csv

Post by Enrico Maria Giordano »

Code: Select all | Expand

#define xlCSV 6


FUNCTION MAIN()

    LOCAL oExcel := CREATEOBJECT( "Excel.Application" )

    LOCAL oSheet

    oExcel:WorkBooks:Add()

    oSheet = oExcel:ActiveSheet

    oSheet:Cells( 1, 1 ):Value = "This is a test 1"
    oSheet:Cells( 1, 2 ):Value = "This is a test 2"
    oSheet:Cells( 1, 3 ):Value = "This is a test 3"

    oExcel:ActiveWorkBook:SaveAs( "E:\XHARBOUR\SAVED.CSV", xlCSV )

    oExcel:ActiveWorkBook:Close( 0 )

    oExcel:Quit()

    RETURN NIL


EMG
Post Reply