2009/12/10(Thu) 21:03:18 編集(投稿者)
# ネタにつき注意
# Scripting Guy に教えてもらいました
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdText = &H0001
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
strPathToTextFile = "C:\temp\"
strFile = "Test.txt"
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPathtoTextFile & ";" & _
"Extended Properties=""text;HDR=NO;FMT=Delimited"""
objRecordSet.Open "select count(*) from " & strFile, _
objConnection, adOpenStatic, adLockOptimistic, adCmdText
Wscript.Echo objRecordSet.Fields.Item(0).Value
[解決済みチェック付けました]