click on link text in internet explorer using vba

Koen de Haan

I want to Click on a link using VBA. The link is on a page and doesn't have a tag or id. The link only has a "link text". The link looks like this:

<a href="http://bulksell.ebay.de/ws/eBayISAPI.dll?FileExchangeDownload&amp;RefId=40637977">Herunterladen</a>

I made the following code in VBA, but I think that it doesn't work because the link doesn't have an ID or something.

Private Sub IE_orderdata_downloaden()
    Dim i As Long
    Dim IE As Object
    Dim objElement As Object
    Dim objCollection As Object

    ' Create InternetExplorer Object
    Set IE = CreateObject("InternetExplorer.Application")

    'IE.Visible = False

    IE.Navigate "http://k2b-bulk.ebay.de/ws/eBayISAPI.dll?SMDownloadPickup&ssPageName=STRK:ME:LNLK"

    ' Wait while IE loading...
    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop

    IE.Visible = True

Set Link = IE.document.getElementsByTagName("a")
    For Each l In Link
        If Link.classname = "Herunterladen" Then
            Link.Click
            Exit For
        End If
    Next l

End Sub

Does someone have any idea how to make this work?

Best regards, and thank you all in advance!

Domenic

Try using innerText instead of classname. Also, you should refer to your control variable l, not Link.

For Each l In Link
    If l.innerText = "Herunterladen" Then
        l.Click
        Exit For
    End If
Next l

Hope this helps!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

vba intercept internet explorer link click

Click link in Internet Explorer

How to click a button in Internet Explorer using VBA

VBA Internet Explorer Webpage Link Selection

Excel VBA Internet explorer click button with no ID

Getting HTML link using Internet explorer with VBA excel (no code error but the results is wrong)

Change Internet Explorer encoding using VBA

link.click(); does not work in internet explorer while working in chrome

How to click the hyperlink (<a> tag) in Internet Explorer through Excel VBA?

Cannot fill text box in internet explorer via VBA

VBA: Copy data/text from an existing open Internet Explorer tab

VBA through Internet Explorer, Find String of Text and Use It

How to click on a link using partial link text

Open link in Internet Explorer with POST data using javascript/jquery

how to open link in internet explorer using html or any browser language?

Hidden text in Internet Explorer

Using Excel VBA to automate form filling in Internet Explorer

How to Target Specific Element in Internet Explorer using Access VBA

Auto save PDF file from Internet Explorer window using VBA

How to click HTML link using VBA

vba internet explorer delete object

VBA - Addressing Internet Explorer tabs

Changing link text on click using CSS

Use Excel VBA to click on a button in Internet Explorer, when the button has no "name" associated

SVG Text with Shadow in Internet Explorer

Text not centering in a span in Internet Explorer

How to click a link using link text in nightwatch.js

click link using getelementsbyclassname vba 7 using access 2007

Permission denied for clicking link in Internet Explorer 11