Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Importing data from Excel
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01127310
Message ID:
01127524
Vues:
9
Hi Russel,

Well, my routine was trying to create a table from any Excel file with any structure, thus more complex. In fact, it worked fine for different files. I think the problem with this file is that originally the columns' widths are not wide enough and therefore when I copy them I somehow lost data. That's just a guess, I'll try tomorrow to work out from this theory and give this code the final touch.

Also Yuri just posted another approach Re: COPY TO an Excel - including Memo fields Thread #844067 Message #1127515, that I may try to use instead.

>Whew! That's a lot of code. I guess my needs are not as detailed. I did end up using automation and the code is below. I got the dates ok via automation, but realized I didn't need to because they just had the date field set up so that it would always display the current date, so there was no point in retrieving it. I didn't have any problems with truncation when using automation, so I'm not sure what might be going on there.
>
>Thanks for everyone's help.
>
>
>.oExcel = createobject("Excel.Application")
>oFile   = .oExcel.Workbooks.Open(.FileName)
>
>IF VARTYPE(oFile) = "O"
>
>   .CustNo = TRANSFORM(.oExcel.Range("D6").value)
>   .SaleId = .CustNo + "SP"
>
>   RowNum = 17
>
>   do while .t.
>
>      m.Item = .oExcel.Range("C" + transform(RowNum)).value
>				
>      if empty(m.Item) or isnull(m.Item)
>         exit
>      endif
>
>      m.Discount = ROUND(.oExcel.Range("H" + transform(RowNum)).value * 100, 2)
>			
>      INSERT INTO QuoteCursor;
>         (item, NewDisc) VALUES (m.Item, m.Discount)
>
>      RowNum = RowNum + 1
>
>   enddo
>
>endif
>
>
>>Hi Russell,
>>
>>I'm working on the exactly same problem at the moment. I've modified my colleague's code and here's what I have right now.
>>
>>The problems, that I need to fix, may be you or someone can help:
>>1) Date columns were not converted correctly
>>2) Long info was truncated to ~10 chars.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform