IE Button click (on loop) with VBA

时间:2016-04-21 22:19:18

标签: javascript html excel vba

I'm having issues with executing the following task:

  1. Working - Open IE and navigate to the intranet webpage (Its a database)
  2. Not working - Click "Delete" button for first row of data
  3. Not working - Wait for IE to refresh and
  4. Not working - Click "Delete" button for second row which is now first.

I want to execute a click-loop that goes through the entire webpage searching for "Delete buttons". Using GetElementByID gives me a RUn Time Error 424 Object Required Error.

This is where I'm getting stuck at. Appreciate your help!!!

Here is the code I'm using:

    Sub Website()

        Dim IE As Object, Doc As Object, UserName As Object, Password As Object, strCode As String

        Set IE = CreateObject("InternetExplorer.Application")
        Set IE = New InternetExplorerMedium
        IE.Visible = True
       ' IE open webpage page

          IE.Navigate "http://abc.com.au"

            Do While IE.ReadyState <> 4: DoEvents: Loop

  End Sub

1 个答案:

答案 0 :(得分:0)

你使用IE.Document.GetELementByID ???

之间必须有一个文件。

如果找不到元素,你应该处理错误。