Link to home
Create AccountLog in
Avatar of newparadigmz
newparadigmzFlag for United States of America

asked on

Excel VBA extract table from website

Very simply, how do I extract this table, using Excel VBA, into Excel?

http://www.treasurydirect.gov/RI/OFNtebnd
ASKER CERTIFIED SOLUTION
Avatar of FamousMortimer
FamousMortimer
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of newparadigmz

ASKER

getting an "Invalid procedure call or argument" error message.

Does this work for you?

Am I missing a library reference?
try commenting out .CommandType = 0 and see if that works
well, that was easy, thanks!

Can I ask, on the most basic level, what is this doing, going in and looking for a table and just grabbing it? What if there were 2 tables on the page?
Thanks!

Basically, the '.WebSelectionType' is where it specifies which table to retrieve.  You can set it to 'xlSpecifiedTables' then specify which tables using the '.WebTables' property.

Here is a an example
http://msdn.microsoft.com/en-us/library/office/aa215965(v=office.11).aspx