I have a CSV file with a printer name, printer ip address, and printer type. I am using vbscript in a hta to read the csv file and put it in a list box. I can get it to work fine but the ip address does not all come up. If I have a IP of 10.20.34.5 it shows up as 10.20 and that's it. My code is below.
''''Setup connection to txt file to read in files
On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
strPathtoTextFile = objShell.CurrentDirectory
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""
objRecordset.Open "SELECT * FROM " & onloadfilename, _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
''''Reads txt file and inputs into drop down box
For Each objOption in PrinterList.Options
objOption.RemoveNode
Next
Do Until objRecordset.EOF
strLine = objRecordset.Fields.Item("PrinterName") & " - " & objRecordset.Fields.Item("IPAddress") & " - " & objRecordset.Fields.Item("PrinterInstalled")
Set objOption = Document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
PrinterList.Add(objOption)
objRecordset.MoveNext
Loop
objRecordset.Close
objConnection.Close
''''Setup connection to txt file to read in files
On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
strPathtoTextFile = objShell.CurrentDirectory
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=YES;FMT=Delimited"""
objRecordset.Open "SELECT * FROM " & onloadfilename, _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
''''Reads txt file and inputs into drop down box
For Each objOption in PrinterList.Options
objOption.RemoveNode
Next
Do Until objRecordset.EOF
strLine = objRecordset.Fields.Item("PrinterName") & " - " & objRecordset.Fields.Item("IPAddress") & " - " & objRecordset.Fields.Item("PrinterInstalled")
Set objOption = Document.createElement("OPTION")
objOption.Text = strLine
objOption.Value = strLine
PrinterList.Add(objOption)
objRecordset.MoveNext
Loop
objRecordset.Close
objConnection.Close