Click a link in the internet

pupsia

Board Regular
Joined
Dec 2, 2015
Messages
67
Hello all,

I`m trying to click a link in Internet Explorer using VBA. Tried a lot of things I could think of, but nothing seems to work.

I tried everything I could think of or find in the internet, but nothing worked so far. I know that normal .Click is not working in this website, so I use .Focus and then .SendKeys in all other places and it usually works. But with this part for some reason it is stuck.. In this case the macro should click on the C letter and open all C letter list, but it is not clicking, but it finds and focuses on the right letter. Any ideas how to fix this?

The whole code:

Code:
Sub FN_CurrencyLetter_TEST()


    Set objShell = CreateObject("Shell.Application")
    Set objAllWindows = objShell.Windows
    For Each ow In objAllWindows
        If (InStr(1, ow, "Internet Explorer", vbTextCompare)) Then
            If (InStr(1, ow.LocationURL, "westernunion", vbTextCompare)) Then
                Set objGoogle = ow
            End If
        End If
    Next
    If objGoogle Is Nothing Then
    Else
        Set objPage = objGoogle.Document
Dim HWNDSrc As Long
HWNDSrc = objGoogle.HWND
SetForegroundWindow HWNDSrc


valiuta = "CZK"


Dim briedis As String


Z = 0
PazymejoRaide = False


Do Until (PazymejoRaide = True Or Z = 3)
    For Each element In objPage.getElementsByClassName("btn btn1")
        If element.innertext = "Add" Then element.Focus: Exit For
    Next element


kartojam:
Dim YD As String
    e = 0
    f = 0
For Each taip In objPage.getElementsByClassName("geoPaginationPanel")
        If taip.getAttribute("eventproxy") Like "isc_AlphabeticalClientPagination*" Then
        YD = taip.ID
               taip.Focus
        Application.SendKeys " "
        Exit For
    End If
Next taip


 For Each elnias In objPage.getElementByID(YD).getElementsByTagName("div")
    If (elnias.getAttribute("eventproxy") Like "isc_SafeLabel*" And elnias.innertext = Left(valiuta, 1)) Then
        briedis = elnias.ID
        elnias.Focus
        Sleep 100
        Application.SendKeys " ", True
        FnWait (1)
    
         Exit For
    End If
  Next elnias


        Do While objGoogle.Busy: DoEvents: Loop
        Do While objGoogle.readyState <> 4: DoEvents: Loop


End If 


End Sub

The part that is not clicking:

Code:
 For Each elnias In objPage.getElementByID(YD).getElementsByTagName("div")    If (elnias.getAttribute("eventproxy") Like "isc_SafeLabel*" And elnias.innertext = Left(valiuta, 1)) Then
        briedis = elnias.ID
        elnias.Focus
        Sleep 100
        Application.SendKeys " ", True
        FnWait (1)
         Exit For
    End If
  Next elnias
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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