Hi, I am editing a vba program and want macro code to click on button in a web page which is below the page. The html for the button is:
Load More WO Notes
If the button does not exists then my macro should run as is. if load button exists then it should be clicked once it loads the data run the rest of the macro file.
My macro code is below. i want the macro inserted after the Next in the below code.
Set Dates = Html.querySelectorAll(".wo-notes-col-1")
Set Matters = Html.querySelectorAll(".wo-notes")
For i = 0 To Dates.Length - 1
Lr = ThisWorkbook.Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row + 1
.Cells(Lr, 1) = Dates.Item(i).innerText
.Cells(Lr, 2) = Matters.Item(i).innerText
Next
End With
Hi Rajsha,
It sounds like you are trying to click a button on a web page to go to the next page and get the data on that next page.
I'll need to know the page/url you are trying to get data from. I can't write any code to interact with the website unless I can examine that page and identify a way to interact with this button.
Also, please attach your workbook with code in your reply.
Regards
Phil
Hi Philip,
Thanks for your reply on this query. What you assumed in the email is exactly what i need. And my sincere apologies that i cant provide URL details due to restrictions. I understand that with out seeing the task or the way of working of the HTML code no one can guess the VBA code. Is there any other thing that i can provide in this regard.
Regards
Rajsha
Hi Rajsha,
I wrote a post on interacting with webpages which may be of help to you
But if the website uses pagination that is controlled in the URL something like:
website.com/?page=x
then you can just load the next page by changing x and resubmitting the url. I cover this approach here
Regards
Phil
Hi Philip, Thanks for letting me know with the above links. I got some idea with that links. Thanks for your hard work in this.
You're welcome.