Data Extraction from Website

dbrown14

New Member
Joined
May 24, 2011
Messages
13
I need help trying to retrieve the source code from a website.

How I normally navigate there:

I start at http://www.bls.gov/home.htm, scroll over Subject Areas, click Consumer Price Index, click Top Picks button for All Urban Consumers database (probably have to scroll down a little), check off Midwest Region All Items, 1982-1984=100 - CUUR0200SA0, click Retrieve Data, click More Formatting Options, check 3 Month Percent Change, then finally click Retrieve Data.


I'm pretty sure there are ways of getting the source code of this webpage using the xmlhttp object and the post method, but I don't know how. Any help would be greatly appreciated. I would prefer to use xmlhttp if possible, but I'm open to other methods.
 

poolhall

Active Member
Joined
Jan 9, 2009
Messages
350
I don't know how to achieve what you're asking but with the iMacro add-on in your browser you can record the sequence of the above steps, and then reproduce them in one click.
 
Last edited:

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
5,999
Your thread title says 'Data Extraction', but your post asks how to retrieve the source code. An XMLhttp request can retrieve the source code and then more VBA is needed to parse the response in some way to retrieve the data.

If you view the HTML source for the final data page (http://data.bls.gov/pdq/SurveyOutputServlet), you will see the form fields and values which need to be sent with the request. Your VBA code will need to construct this string and send it in a POST request. Something like this:

Code:
XMLhttp.Open "POST", "http://data.bls.gov/pdq/SurveyOutputServlet", False
XMLhttp.send formData
'Response is in XMLhttp.responseText
 

Forum statistics

Threads
1,082,273
Messages
5,364,163
Members
400,784
Latest member
reddsables

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top