最近用VB写了一个自动提交网页的程序,遇到了些问题
对网页上的这一段代码 INPUT onclick=addRowToTable(); class=editBottomButton type=button value=增加 ,应该输入哪一个字段能让按钮点击的动作发生?
附部分原代码:
Private Sub Command4_Click()
Dim SheetID As Integer
Dim firstRowID As Integer
Dim TotalBitID As Integer
Dim i As Integer
Dim j As Integer
Dim keyID(7) As Object
Dim rowID(7) As Object
SheetID = Int(sheet.Text) '设定表编号,即Sheet的编号。
Set ExcelApp = CreateObject("Excel.Application") '
Set ExcelBook = ExcelApp.Workbooks.Open(App.Path + "\导入模板.XLS") '路径
Set ExcelSheet = ExcelBook.Worksheets(SheetID) '
firstRowID = Int(firstRow.Text) '读取起始行
TotalBitID = Int(TotalBit.Text) '要读取的行数
For i = 0 To (TotalBitID - 1)
For j = 0 To 7
If key(j).Text <> "" Then
Set rowID(j) = ExcelSheet.Range(row(j).ToolTipText & firstRowID)
Set keyID(j) = WebBrowser1.Document.All(key(j).Text)
keyID(j).Value = rowID(j).Value
End If
Set rowID(j) = Nothing
Set keyID(j) = Nothing
Next j
WebBrowser1.Document.All(submit.Text).Click
firstRowID = firstRowID + 1 '循还
Next i
ExcelApp.Quit
Set ExcelSheet = Nothing
Set ExcelBook = Nothing
Set ExcelApp = Nothing
End Sub
程序截图:
要自动填写的网页: