Hi!
My problem first, im getting stuck in an endless loop while reading data into my recordset.
Plattform: Excel 2003
Okay so im working with this textfile. I need to read it, manipulate it and save it back with the new info.
After some thinking I think that using ADO technique is the best way to do this.. I have spent some time reading which in turn covers the use of ADO when reading it into a textfile..
This is my textfile data
To read this textfile into a recordset i use this code, but I get stuck in a neverending loop?!
Does someone have any tips on how to solve this?
My problem first, im getting stuck in an endless loop while reading data into my recordset.
Plattform: Excel 2003
Okay so im working with this textfile. I need to read it, manipulate it and save it back with the new info.
After some thinking I think that using ADO technique is the best way to do this.. I have spent some time reading which in turn covers the use of ADO when reading it into a textfile..
This is my textfile data
Code:
datum1, aktivitet, datum2
#2011-06-24#,XXXXXXXXXXX,2011-06-28
#2011-06-25#,XXXXXXXXX,2011-06-29
#2011-06-28#,XXXXXX XXXXXXXX,2011-07-06
#2011-07-01#,XXX XXX XXXX,2011-07-09
#2011-07-01#,XXXXX XXXX,2011-07-09
#2011-07-06#,XXXXX XXXXXXXXX,2011-07-24
To read this textfile into a recordset i use this code, but I get stuck in a neverending loop?!
Does someone have any tips on how to solve this?
Code:
On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H1
Set objConnection = CreateObject("ADODB.Connection")
Set objrecordset = CreateObject("ADODB.Recordset")
strPathtoTextFile = "k:\handläggningsstöd\Ärenden\"
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""
MsgBox ("halvägs")
objrecordset.Open "SELECT * FROM logg-för-9001161778.ini", _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
MsgBox ("filen öppnad")
Do Until objrecordset.EOF
Wscript.Echo "Name: " & objrecordset.Fields.Item("datum1")
Wscript.Echo "Department: " & objrecordset.Fields.Item("aktivitet")
Wscript.Echo "Extension: " & objrecordset.Fields.Item("datum2")
objrecordset.MoveNext
Loop