Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing from Excel into Memo Fields
Message
De
03/10/2000 04:59:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
02/10/2000 20:47:03
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00423847
Message ID:
00423916
Vues:
19
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform