Get refreshed HTML CONTENT on clicking search pushbutton in VBA macro

RaheelFarooq

New Member
Joined
Dec 17, 2016
Messages
1
Hi All,
I am new to VBA macros.
I am trying to set values of different fields of webpage using vba code and then click search button. And after clicking search button HTML Content of page will be refreshed. I want to retrieve refreshed data using HTML Object

I am getting HTML content using below object code

PROCESS STEPS:

STEP1: GET THE DEFAULT CONTENT OF URL AND STORE IT IN HTMLFILE OBJECT

Web_URL = "http://www.ksestocks.com/Announcements"
'Create HTMLFile Object
Set HTML_Content = CreateObject("htmlfile")
'Get the WebPage Content to HTMLFile Object
With CreateObject("msxml2.xmlhttp")
.Open "GET", Web_URL, False
.send
HTML_Content.Body.Innerhtml = .responseText
End With


STEP2: SET VALUES OF DIFFERENT FIELDS OF WEBPAGE USING HTML_Content.getElementsByTagName


STEP3: CLICK SEARCH PUSHBUTTON USING BELOW CODE

Set elems = HTML_Content.getElementsByTagName("input")
For Each e In elems
If (e.getAttribute("value") = "Search Database") Then
e.Click


STEP4: NOW AFTER CLICKING SEARCH BUTTON; HTML WEBPAGE CONTENT GETS REFRESHED

STEP5: I WANT TO GET THE REFRESHED HTML CONTENT AGAIN IN A NEW HTMLFILE OBJECT

STEP6: ONCE I HAVE REFRESHED/UPDATED CONTENT IN A HTMLFILE CONTENT I WILL DO FURTHER PROCESSING.





STEP5 AND STEP6 IS WHAT I AM LOOKING ASSISTANCE FOR.


YOUR DETAILED RESPONSE WILL BE HIGHLY APPRECIATED. WHAT CODE I NEED AFTER STEP4 CLICK BUTTON


REGARDS,
RAHEEL FAROOQ
 

Forum statistics

Threads
1,226,835
Messages
6,193,230
Members
453,781
Latest member
Buzby

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