搞定!!!自己搞定啦 Dim vDoc, vTag Dim i As Integer Dim j As Integer Dim desstring, myarray '定义每行的目的字符串,及数组对象 Set vDoc = Me.WebBrowser1.Document For i = 0 To vDoc.All.Length - 1 If UCase(vDoc.All(i).tagname) = "INPUT" Then Set vTag = vDoc.All(i) If vTag.Type = "text" Or vTag.Type = "textarea" Then '自动匹配算法 'Static p As Integer 'p = 2 Dim openfso As New FileSystemObject, openfile As TextStream Set openfile = openfso.OpenTextFile(CommonDialog1.FileName, ForReading) Do While Not openfile.AtEndOfLine
desstring = openfile.ReadLine myarray = Split(desstring, "$", -1, vbTextCompare) If vTag.Name = myarray(0) Then vTag.Value = myarray(1) End If 'end if value 'p = p + 1 Loop 'loop the while '退回到文本头
End If 'end if vtag.type="text"... End If 'end if ucase(....) Next i 'next i MsgBox "所有信息已提取", vbOKOnly + vbInformation, "成功读取文件" Exit Sub errHander: Exit Sub
那边有很多资料!
Dim vDoc, vTag
Dim i As Integer
Dim j As Integer
Dim desstring, myarray '定义每行的目的字符串,及数组对象
Set vDoc = Me.WebBrowser1.Document
For i = 0 To vDoc.All.Length - 1
If UCase(vDoc.All(i).tagname) = "INPUT" Then
Set vTag = vDoc.All(i)
If vTag.Type = "text" Or vTag.Type = "textarea" Then
'自动匹配算法
'Static p As Integer
'p = 2
Dim openfso As New FileSystemObject, openfile As TextStream
Set openfile = openfso.OpenTextFile(CommonDialog1.FileName, ForReading)
Do While Not openfile.AtEndOfLine
desstring = openfile.ReadLine
myarray = Split(desstring, "$", -1, vbTextCompare)
If vTag.Name = myarray(0) Then
vTag.Value = myarray(1)
End If 'end if value
'p = p + 1
Loop 'loop the while
'退回到文本头
End If 'end if vtag.type="text"...
End If 'end if ucase(....)
Next i 'next i
MsgBox "所有信息已提取", vbOKOnly + vbInformation, "成功读取文件"
Exit Sub
errHander:
Exit Sub
End Sub