get data from webpage in excel

auto

Board Regular
Joined
May 20, 2012
Messages
53
hi, everyone;
i am having a code to navigate my IE browser to a webpage, and then from there i want the whole webpage to copy it into my excel sheet. can anyone help me with that?
webquery is not an answer! because i need to do some log-in and other functions till i get to that specific page that i need.
i made already all functions, but i get stuck when it comes to copy the page and paste it into excel, can anyone help me with some coding?
 

auto

Board Regular
Joined
May 20, 2012
Messages
53
let me give some idea what i tried and i am getting an error,

'this will select all'
ie.ExecWB 17, 0
'copy'
ie.ExecWB 12, 0
ie.Quit

'this is the target where the data have to go in'

xlSheet2.Activate
Range("A1").Select
Selection.PasteSpecial xlPasteValues

error pastespecial method of range class failed

any idea what is wrong?
 

auto

Board Regular
Joined
May 20, 2012
Messages
53
ok, got it, the problem was i need to write this,

xlSheet2.PasteSpecial xlPasteValues

now its working!!
xlsheet2 was set before as a range, so i didnt have to select it.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
Just curious but why the entire page?

You could extract only the data you want from the page.
 

auto

Board Regular
Joined
May 20, 2012
Messages
53
did you have a way to select a specific place in the page and copy it using ie.ExecWB 12, 0?
if yes can you provide me the code?
really appreciated.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
Not using ExecWB, but accessing the elements of the page, eg tables, and putting the data into Excel.
 

auto

Board Regular
Joined
May 20, 2012
Messages
53
can you give me some coding?
let say i need table 7
how will i do that?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
It's hard to give any code without further details.

Apart from a few things, eg opening IE and navigating to the URL, the code will be different for each page/site.
 

auto

Board Regular
Joined
May 20, 2012
Messages
53
thanks for willing to help me, i will give you the source of my page where the table i need to extract, for security reasons i need to edit the shipping info, so i set that to john smith, basically i need that table it contains shipping address.
here it is.

Code:
<table class="data-display" cellspacing="1"><tbody> <tr class="list-row"> <td class="data-display-field" width=30% valign="top"><strong>Shipping Address:</strong><br>john<br>smith<br>1111 Example St.<br>Brooklyn, NY 12090<br></td> <td class="data-display-field" width=50% valign="top"> <table class="data-display" cellspacing="0" cellpadding="0"><tbody> <tr class="list-row"></pre>
 
Last edited by a moderator:

auto

Board Regular
Joined
May 20, 2012
Messages
53

<tbody>
</tbody>

<tbody>
</tbody>
k
 
Last edited:

Forum statistics

Threads
1,082,275
Messages
5,364,180
Members
400,785
Latest member
Mahar92

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