IE Automation

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
I have this script from a site that I use.

Code:
' [SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]input[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]type[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]="submit"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]value[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]="Post this comment"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]name[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]="button"[/COLOR][/SIZE][/COLOR][/SIZE]

I would like a vba that would click on the button on whatever page I am in as the page address changes each time.

example.
I use
appactivate("Internet Explorer") and then I want to hit the button using script from there.

Also, do I need a specific reference installed to do this.

I tried the following.

Code:
sub Test()
ActivateWindow ("Internet Explorer")
 ie.Document.getElementById("button").Click
End sub

Also tried

Code:
sub Test()
ActivateWindow ("Internet Explorer")
ie.Document.getElementById("Post this comment").Click
end sub

and tried


Code:
sub Test()
ActivateWindow ("Internet Explorer")
 For x = 0 To 1
 
        For i = 0 To ie.Document.forms(x).Length - 1
 
            'MsgBox ie.Document.forms(x)(i).Value & " " & ie.Document.forms(x)(i).Type
 
            If ie.Document.forms(x)(i).Value = "Set" And ie.Document.forms(x)(i).Type = "submit" Then
                ie.Document.forms(x)(i).Click
                Exit For
            End If
 
        Next i
 
    Next x
end sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,215,548
Messages
6,125,464
Members
449,229
Latest member
doherty22

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top