IE Automation

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,063
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,216,566
Messages
6,131,437
Members
449,652
Latest member
ylsteve

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