Trouble For Next
I'm having trouble with the For Next statement in Bartender VB script below:
dim objConn
dim strConn
dim rs
strConn = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source='C:\Users\RMA\Desktop\2DTest\2dTest.xls';Extended Properties=""Excel 12.0 Xml;HDR=YES;"""
Dim strNames
Set objConn = CreateObject("ADODB.Connection")
objConn.Open strConn
Set rs = CreateObject("ADODB.Recordset")
Set rs = objConn.Execute("Select * FROM [Sheet1$]")
strNames = ""
rs MoveFirst()
j = 1
for j = 1 to 86
strNames = strNames + CStr(rs.fields("IMEI")) + vbCrLf
rs.MoveNext()
next
value=strNames
It seems that if the Excel file that I'm getting the data from does not have 86 rows of data it gives me an invalid use of null CStr error. All computers have Windows 7 64 bit and Office 2013. All computers have Bartender 9.3 SR2.
-
On Error Resume Next
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar