ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Click a link (https://www.excelbanter.com/excel-programming/405546-vba-click-link.html)

GTVT06

VBA Click a link
 
Hello,
I'm trying to click a link inside of a frame in Internet Explorer. For
some reason my code below doesn't click it. The Debug.Print recognizes
the link but the link.Click isn't working for some reason.
This is my 1st time trying to click on a link inside of a frame so
maybe it's done different from how I'm trying?

For x = 0 To IE.Document.frames.Length - 1
Set f = IE.Document.frames(x)
For Each link In f.Document.Links
If link.innerText = "Download" Then
link.Focus
link.Click
Do While IE.Busy And Not IE.readyState = 4:
Loop
Exit For
End If
Debug.Print "Frame " & x & ": " & link.innerText
Next link
Next x

Tim Williams

VBA Click a link
 
Should work, but hard to tell why it doesn't without seeing the page you're
working on.

Tim

"GTVT06" wrote in message
...
Hello,
I'm trying to click a link inside of a frame in Internet Explorer. For
some reason my code below doesn't click it. The Debug.Print recognizes
the link but the link.Click isn't working for some reason.
This is my 1st time trying to click on a link inside of a frame so
maybe it's done different from how I'm trying?

For x = 0 To IE.Document.frames.Length - 1
Set f = IE.Document.frames(x)
For Each link In f.Document.Links
If link.innerText = "Download" Then
link.Focus
link.Click
Do While IE.Busy And Not IE.readyState = 4:
Loop
Exit For
End If
Debug.Print "Frame " & x & ": " & link.innerText
Next link
Next x





All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com