Excel VBA - Get data from HTML-document

depple

Board Regular
Joined
Sep 18, 2009
Messages
64
Hi,

I am at the very beginning of learning how to get data from web pages, so please forgive me for a potential poor explanation. I am able to get some data of other parts of the .document that are easily available, but I have reached a part that I do not even know how to google for.

It might be obvious for a more skilled html-reader, but dt is the parameter and dd its variable. Ideally, the code would look for "Girkasse" and retrieve "Manuell".
HTML:
<dl class="example">    <dt data-automation-id="key">Farge</dt>        <dd data-automation-id="value">Rød</dd>    <dt data-automation-id="key">Girkasse</dt>        <dd data-automation-id="value">Manuell</dd>    <dt data-automation-id="key">Hjuldrift</dt>        <dd data-automation-id="value">Firehjulsdrift</dd>    <dt data-automation-id="key">Drivstoff</dt>        <dd data-automation-id="value">Diesel</dd></dl>
</div>I hope that I have provided sufficient information.
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Trying to get it vertical by removing the leading <

dl class="example">
dt data-automation-id="key">Farge</dt>
dd data-automation-id="value">Rød</dd>
dt data-automation-id="key">Girkasse</dt>
dd data-automation-id="value">Manuell</dd>
dt data-automation-id="key">Hjuldrift</dt>
dd data-automation-id="value">Firehjulsdrift</dd>
dt data-automation-id="key">Drivstoff</dt>
dd data-automation-id="value">Diesel</dd>
/dl>





Thank you for the reply.

Ok, I am bit beyond that. I have another code snippet that is working:

Code:
For Each ele In .document.all
            For Each ele In .document.all
[INDENT]            Select Case ele.classname[/INDENT]
[INDENT=2]            Case "inner r-pal"[/INDENT]
[INDENT=3]            RowCount = RowCount + 1[/INDENT]
[INDENT=2]            Case "t4 word-break mhn mvs result-item-heading"[/INDENT]
[INDENT=3]            sht.Range("A" & RowCount) = Replace(ele.ID, "result-item-heading-", "")[/INDENT]
[INDENT]            End Select[/INDENT]
Next ele

But I have no Idea how to look for "Girkasse" and retrieve "Manuell" :confused:
 
Upvote 0

Forum statistics

Threads
1,225,487
Messages
6,185,276
Members
453,285
Latest member
Wullay

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