How to scrap the data from webpage by VBA script??

karthik80c
karthik80c used Ask the Experts™
on
I have the URL of a webpage, in which i need to scrap the data from.

The URL will be send to my email. In outlook, I have created the rule with VBA script to fetch the URL from the mail when it received. Now I need to scrap the data from the URL page using VBA script. I tried to get the code from internet. They all scripted to get values from the web page table into excel, but i need it to store as text in VB variable.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer
Commented:
An example using WinHttpRequest object


Dim result As String
Dim myURL As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
 
myURL = "http://server:80/path/to/yourpage?param1=value1&param2=value2"
 
winHttpReq.Open "GET", myURL, False
winHttpReq.Send
 
//result is stored here
result = winHttpReq.responseText

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial