Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: mike N
  Where is mike N?
 Balt
 Maryland - United States
 mike N
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: Visual Foxpro .CSV code help needed.
Thread ID: 210129 Message ID: 210160 # Views: 28 # Ratings: 0
Version: Visual FoxPro 9 Category: Microsoft Office Automation
Date: Saturday, January 03, 2009 8:02:06 PM         
   


> >
> > I should also add this excel(csv) file uses data all the way to columns BC
> > and contains 20k+ rows of data. This one code is all I need to change.
> > Mike
>
> Mike,
> Sorry I couldn't understand your requirement exactly. Maybe you want to change it directly in Excel w/o getting into VFP? If so:
>
>
lcXLS = getfile('XLS')
> oExcel = createobject('Excel.Application')
> with oExcel
>  .Workbooks.Open(m.lcXLS)
>  .Visible = .t.
>  with .ActiveWorkbook.Activesheet
>     for ix = 1 to .UsedRange.Rows.Count
>       if .Cells(m.ix,1).Value = '0125' and .Cells(m.ix,2).Value ='FDC'
>          .Cells(m.ix,2).Value = 'IDC'
>       endif
>     endfor
>  endwith
> endwith

>
> This would be slow but for 20K might not be important. You can also directly open Excel sheet as a cursor (CursorAdapter and ACE OleDb driver - check message id 153776 for a sample) and do an update.
>
>
> Or do you mean you want to put the changed data back to Excel? - 153776 has a sample for that too.
>
> PS: I think I need to repeat that it is not a CSV file. Append from .. type CSV would fail.
>
> Cetin Basoz


This code looks like it will do the job. Since I already have the file open I plan to just run the code to change the FDC to IDC and then continue on with the orig. processing of the file into tables.
Thank you and will give it a shot on Monday.
Like I said you are on top of it!!



COMPLETE THREAD
Visual Foxpro .CSV code help needed. Posted by mike N @ 1/3/2009 2:35:59 PM
RE: Visual Foxpro .CSV code help needed. Posted by Anders Altberg @ 1/3/2009 3:21:29 PM
RE: Visual Foxpro .CSV code help needed. Posted by Cetin Basoz @ 1/3/2009 3:33:23 PM
RE: Visual Foxpro .CSV code help needed. Posted by mike N @ 1/3/2009 4:37:31 PM
RE: Visual Foxpro .CSV code help needed. Posted by mike N @ 1/3/2009 4:41:39 PM
RE: Visual Foxpro .CSV code help needed. Posted by Cetin Basoz @ 1/3/2009 5:22:19 PM
RE: Visual Foxpro .CSV code help needed. Posted by mike N @ 1/3/2009 8:02:06 PM
RE: Visual Foxpro .CSV code help needed. Posted by Anders Altberg @ 1/3/2009 8:22:47 PM
RE: Visual Foxpro .CSV code help needed. Posted by Cetin Basoz @ 1/3/2009 10:08:08 PM
RE: Visual Foxpro .CSV code help needed. Posted by mike N @ 1/7/2009 8:57:19 PM
RE: Visual Foxpro .CSV code help needed. Posted by Cetin Basoz @ 1/8/2009 1:52:17 AM
RE: Visual Foxpro .CSV code help needed. Posted by tushar @ 1/3/2009 4:59:49 PM