Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing from Excel into Memo Fields
Message
From
03/10/2000 04:59:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/10/2000 20:47:03
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00423847
Message ID:
00423916
Views:
18
>Hi All,
>
> I'm trying to import an Excel Spreadsheet into a VFP6.0 DBF which has Memo Fields and the Memos aren't being populated. The reason that I need to use Memos is that some of the Cells in the Excel file Exceed 254 characters. After the Import all the character fields are populated correctly but the Memos are left empty even though there are corresponding Cells in the Excel File. I desperately need to extract the fields from Excel, I've even tried saving the file as CSV and importing/appending from a Delimited file but that doesn't work either. I'm assuming here that 'Append From' and 'Import From' don't work for Memos unless Appending from a DBF?
>
>Another way that I thought of to import the data was to use OLE to open the Spreadsheet and loop through the Cells and insert them into the DBF. Does anyone know how to read an Spreadsheet using OLE, I know how to create one using OLE but not how to do the reverse. I don't really want to use low level file functions either <s>.
>
>Thanks,
>Gavin...


Gavin,
This would read max 65000 cells into array :
#define xlLastCell  11
oExcel = createobject('Excel.Application')
With oExcel
    .WorkBooks.Open(lcBookName)
    With .Activeworkbook
        .WorkSheets(lcSheetName).Activate
        With .ActiveSheet
            .Range("A1").SpecialCells(xlLastCell).CurrentRegion.Select
            lnRows = .Application.Selection.Rows.Count
            lnCols = .Application.Selection.Columns.Count
            If lnRows * lnCols <= 65000
                Dimension aExcelData[lnRows,lnCols]
            Else
                Dimension aExcelData[int(65000/lnCols),lnCols]
            Endif
            For ix = 1 to lnRows
                For jx = 1 to lnCols
                    aExcelData[ix, jx] = .Cells(ix,jx).Value
                Endfor
            Endfor
        Endwith
    Endwith
    .Activeworkbook.Saved = .t.
    .quit
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform