【问题标题】:IE Automatin Clicking buttons VBAIE Automatin 点击按钮 VBA
【发布时间】:2015-01-29 02:34:32
【问题描述】:

我无法从我的 HTML 代码访问提交按钮,我尝试了一些代码,但这些都不起作用。希望你们能从以下信息中找到解决方案。

我的代码:

Sub GetIE()

Dim shellWins As ShellWindows
Dim IE As InternetExplorer

Set shellWins = New ShellWindows
Set IE = shellWins.Item(0)

IE.document.all("linerepricedamount").Value = "Value"
IE.document.all("linestatus").Value = "value"

'In Next step i want to click a submit button
'I Tried everything but those codes are not working

Set IE = Nothing
Set shellWins = Nothing

End Sub

HTML 代码:

<TD> <Input id="button" Type="Button" Value= "SaveLine" Name= "Button"
onclick="JavaScript:return save_line_onclick("saveline.d")> </TD>`

【问题讨论】:

    标签: javascript excel vba automation


    【解决方案1】:

    你需要触发 onclick 事件

    Dim btnObject as Object
    
    Set btnObject = IE.document.getElementbyID("button")
        btnObject.FireEvent("onclick")
    

    希望能解决你的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-19
      • 1970-01-01
      • 2019-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多