0
當我嘗試這樣做時,它會在我身上拋出一些錯誤,這取決於我的代碼的其他位,例如方法不與該對象或未指定的錯誤關聯。IE.Document.getElementsByName(「name」)。Value =「Value」not working [VBA]
我想下去的Excel單元格的字符串列表,並使用Web窗體來搜索這些字符串。幫幫我!
我的代碼目前看起來是這樣的:
Sub YSF_automation()
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "URL"
While IE.Busy
DoEvents
Wend
IE.Document.getElementsByName("ElementName")(0).Value = "test"
End Sub
沒有看到任何你的代碼,這是最好的,我有...修改代碼,'IE.Document .getElementsByName(「name」)(0).Value =「Value」' – user1
IE.Document.getElementsByName(「name」)返回不是單個元素的元素集合,因此您無法設置它的值。試試@ user1建議的內容。請記住,集合中的索引將從0開始,因此請按照您的要求進行更改。 – sktneer
這是我正在嘗試寫入的文本框的HTML:。 – YaYaYaYaYaYa