1

I want to click on the following link

enter image description here

I have the class name and the line code I was trying ot use is the following:

objIE.document.getElementByClassName("msDataText searchLink").Click 

This may well be a very basic question.. any guidance

Thanks a lot

1 Answer 1

1

Not sure if it is a duplicate question. A good function GetHTTPResult is already available from the link. You need to just pass the url for the GET request to fetch the data. For POST request (this function will not work), you need to make a POST request with postdata.

Also there is a sample for XMLHttpRequest at link

Function GetHTTPResult(sURL As String) As String Dim XMLHTTP As Variant, sResult As String Set XMLHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") XMLHTTP.Open "GET", sURL, False XMLHTTP.Send Debug.Print "Status: " & XMLHTTP.Status & " - " & XMLHTTP.StatusText sResult = XMLHTTP.ResponseText Debug.Print "Length of response: " & Len(sResult) Set XMLHTTP = Nothing GetHTTPResult = sResult End Function 
Sign up to request clarification or add additional context in comments.

4 Comments

I will try this, but I thought there may have been a way without actually extracting the reference, to select (or activate) the link. In thesame way I can search by tag the search bottom of google my expectation is that I could .click the link once I pointed to it through a getelementbyclass function.. ah I am using excel 2013 to pull data out finace site (if this add info to the request)
Actually, after a better seach I found this link stackoverflow.com/questions/24638533/…. The last comment seems to point at hte solution i was proposing but seems not to work..
Remove the click, make it as Dim obj As Object Set obj = objIE.document.getElementByClassName("msDataText searchLink") Assign it to an object and in watch window see the details of the object. It will give you some hint.
out of context... I attach the full code till the point it crashes.. pleae let me know.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.