Hi All
i need the code written in VB where i m reading a perticuler cell's value from .CSV file and writing that value into a perticuler cell into XLS file.
IT IS VERY VERY VERY URGENT...
I NEED UR HELP....
Thanks & Regards
Pankaj Bahuguna
Reding .CSV file in VBReding .CSV file in VB
Page 1 of 1
1 Replies - 5227 Views - Last Post: 12 December 2008 - 03:41 PM
Replies To: Reding .CSV file in VB
#2
Re: Reding .CSV file in VB
Posted 12 December 2008 - 03:41 PM
Here is a short example. If you need more info let me know. I have several applications where I use csv files to populate Excel worksheets.
Public objXcl As Excel.Application
Set objXcl = Excel.Application
objXcl.Workbooks.Add
objXcl.Sheets(1).Select
‘Open csv file, then read
Do Until EOF(nFileNbr)
Input #nFileNbr, sTextField(0), sTextField(1), sTextField(2), sTextField(3)
With objXcl
Range("B1").Select
.Range("B1").Value = sTextField(0)
Range("B2").Select
.Range("B2").Value = sTextField(1)
Range("B3").Select
.Range("B3").Value = sTextField(2)
End With
Loop
Hope this helps,
Ron Brewer
Public objXcl As Excel.Application
Set objXcl = Excel.Application
objXcl.Workbooks.Add
objXcl.Sheets(1).Select
‘Open csv file, then read
Do Until EOF(nFileNbr)
Input #nFileNbr, sTextField(0), sTextField(1), sTextField(2), sTextField(3)
With objXcl
Range("B1").Select
.Range("B1").Value = sTextField(0)
Range("B2").Select
.Range("B2").Value = sTextField(1)
Range("B3").Select
.Range("B3").Value = sTextField(2)
End With
Loop
Hope this helps,
Ron Brewer
Page 1 of 1