Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read data from Excel sheet???

Status
Not open for further replies.

qajussi

Programmer
Mar 22, 2004
236
US
Hi!

I am extracting data from Excel Sheet and writing them to a file using FileSystemObject after creating a textfile.
I can read and write with objRs.Fields(0) fine with size of the value of the field smaller than 255(not quite sure exact size).
But I can't read size seems to be larger than 255 in the field of Excel column.
I can read this "EPIDEMIC ENCEPHALITIS B VACCINE AND PREPARATION BY USING LEPIDOPTERA MYBHIMUA SEPARATA OVARY CELLS"
but not this size "The preparation method includes culture of ovary cells of spodoptera frugiperda, infecting the cells with encephalitis B virus, continuous culture and supplement of culture liquor, thus the deactivated or activated vaccine can be obtained. In present method the culture medium is aserum one."

How can I read this and write to a file??
With Access database records I used getChunk() but with Excel seems not working..

Anyone know how to handle this???
Please help.
Thank you.



 
Sorry I forgot to include the lines of code.
et objConn = CreateObject("ADODB.Connection")
objConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=C:\q\vbs\china\PatentListRev1.xls;" & _
"DefaultDir=C:\q\vbs\china"

Set objRs = CreateOBject("ADODB.RecordSet")
objRs.open "SELECT * FROM [Most Important Patents$]", objConn

Set fso = CreateObject("Scripting.FileSystemObject")
Set ofile = fso.CreateTextFile("C:\q\vbs\china\PatentReference.html")
ofile.WriteLine("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>")
ofile.WriteLine("<html><head><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>" & _
"<title>Patents Reference - Shenandoah</title></head>")
ofile.WriteLine("<body>")
ofile.WriteLine("<table border='1' width='600'>")
Do While Not objRs.EOF
ofile.WriteLine("<tr>")


if (len(objRs.Fields(0))>0) then
temp = objRs.Fields(0)
else
temp = "---"
End If
ofile.WriteLine("<td>")
ofile.WriteLine(temp)
ofile.WriteLine("</td>")
****************************
I can't use the getChunk in here....

if (len(objRs.Fields(3))>0) then
'temp = objRs.Fields(3)
vntChunk = objRs.Fields(3).GetChunk(500)
temp = vntChunk
Do Until IsNull(vntChunk) = True
vntChunk = objRs.Fields(3).GetChunk(500)
temp = temp & vntChunk
Loop
else
temp = "---"
End If
ofile.WriteLine("<td>")
ofile.WriteLine (temp))
ofile.WriteLine("</td>")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top