VBA copy WebTable to Excel

Misca

Well-known Member
Joined
Aug 12, 2009
Messages
1,749
Office Version
  1. 365
Platform
  1. Windows
I've been working with this little project of mine for quite a while now and now I seem to be stuck right before the finish line:

I've got a macro that opens IE and navigates to a site in our intranet, fills a form found on the website and submits it. So now we're in the right webpage and there's 3 tables on the page. I'm trying to copy the last one to the page in Excel for further calculations but
Code:
Range("A1").Value = IE.document.getelementsbytagname("Table")(2).innertext
copies all the values from the whole table in a single cell.

How do I get the code to split the text into cells? I know there's going to be 10 columns in each row but the number of rows can be anything from 2 (including the headers) to 50 +.

Also, how do I tell the browser to go back to previous page? Once I'll get the values copied I need to loop the code back to the form page, change the value of the month dropdown, submit the form and copy the new values from the same table below the previous months values.

If I'm using the navigate back to first URL IE seems to open the form without any values but using the back button it remembers the previous values and I don't have to enter all the values again. I know it shouldn't make that much of a difference to have the code fill the form again but I'm trying to find a better way.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
wow, i have the same question, dealing with the same issue now, i am getting few rows of info into one cell, did you got out of it?
can someone help with that?
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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