单击使用VBA提交时,HTML表单数据无法识别

我使用电子表格中的数据填写表格。 我有一切工作正常,但当我点击提交(无论是手动或通过代码),网站上的validation无法识别表格填写。 它错误地指出,文本框/combobox都是空白的。 我如何刷新,以便知道有数据填充? 如果代码是业余的,我提前道歉,但这是我第一次与Web表单交互。

这里是代码:

Sub AddNewDevice() Dim objCollection As Object For Each wd In CreateObject("Shell.Application").Windows If wd = "Internet Explorer" Then If InStr(UCase(wd.document.Title), "ADD A NEW CISCO ACS") <> 0 Then 'Debug.Print "Yes" Exit For End If End If Next wd wd.Visible = True Set objCollection = wd.document.getElementsByTagName("input") i = 0 While i < objCollection.Length 'Name If objCollection(i).Name = "Y__0__Cctl1_ctl8_ctl2_6_ctl4__X" Then objCollection(i).Value = Sheets("Main").Range("b4") End If 'Description If objCollection(i).Name = "Y__0__Cctl1_ctl8_ctl2_7_ctl4__X" Then objCollection(i).Value = Sheets("Main").Range("b5") End If 'IP Address/Subnet If objCollection(i).Name = "Y__0__Cctl1_ctl8_ctl2_11_ctl4__X" Then objCollection(i).Value = Sheets("Main").Range("b6") End If 'TACACS+ If objCollection(i).Name = "Y__0__Cctl1_ctl8_wctl1_2_ColumnEditor1__X" Then objCollection(i).Click End If 'Shared Secret If objCollection(i).Name = "Y__0__Cctl1_ctl8_wctl1_3_ColumnEditor1__X" Then objCollection(i).Value = Sheets("Main").Range("B22") End If 'Single Connect If objCollection(i).Name = "Y__0__Cctl1_ctl8_wctl1_4_ColumnEditor1__X" And _ Sheets("Main").Range("B25") = "Yes" Then objCollection(i).Click End If 'Legacy TACACS+ If objCollection(i).Name = "Y__0__Cctl1_ctl8_wctl1_5_ColumnEditor1__X" And _ Sheets("Main").Range("B25") = "Yes" Then objCollection(i).Click End If i = i + 1 Wend Set objCollection = Nothing Set objCollection = wd.document.getElementsByTagName("select") i = 0 While i < objCollection.Length 'Location If objCollection(i).Name = "Y__0__C22_ctl8_ctl2_8_ctl4_wctl1__X" Then objCollection(i).selectedIndex = Sheets("Main").Range("B23") End If 'Device Type If objCollection(i).Name = "Y__0__C22_ctl8_ctl2_9_ctl4_wctl1__X" Then objCollection(i).selectedIndex = Sheets("Main").Range("B24") End If 'DSR and Above If objCollection(i).Name = "Y__0__C22_ctl8_ctl2_10_ctl4_ctl1__X" Then objCollection(i).selectedIndex = 2 End If i = i + 1 Wend Set submitButton = wd.document.getElementById("Y__0__Cctl10___X") 'submitButton.Click Set objCollection = Nothing End Sub