FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to create an Excel .csv
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
How to create an Excel .csv
Posted: Thu Dec 11, 2008 01:52 PM

To All

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

Many Thanks
Rick Lipkin

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: How to create an Excel .csv
Posted: Thu Dec 11, 2008 04:40 PM
#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

Continue the discussion