getting the url string from a dynamic text link

TahorSuiJurisBenYAH

New Member
Joined
Dec 21, 2015
Messages
7
Hello,

How would I be able to extract the URL
HTML:
http://www.koeppelnissan.com
- that is within the below class="rllt__action-button _Jrh" ?

Any and all suggestions, greatly appreciated.

REF:
Dim sDD As String
Dim aDD As Variant
'-------------------------------------------------
'GET WEBSITE - COLUMN 5/E
sDD = Trim(Doc.getElementsByClassName("rllt__action-button _Jrh")(0).outerHTML)
MsgBox sDD

aDD = Split(sDD, ",")
'ActiveSheet.Range("e" & x).Value = aDD(1)
'---------------------------------------------------

'
HTML:
<a class="rllt__action-button _Jrh" href="/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiQ3P6h_5zKAhUF7A4KHbLnACgQgU8IEzAA&url=http%3A%2F%2Fwww.koeppelnissan.com%2F&usg=AFQjCNGkovFpjdBhADg_eKigryNOkISaTQ" data-ved="0ahUKEwiQ3P6h_5zKAhUF7A4KHbLnACgQgU8IEzAA" onmousedown="return rwt(this,'','','','1','AFQjCNGkovFpjdBhADg_eKigryNOkISaTQ','','0ahUKEwiQ3P6h_5zKAhUF7A4KHbLnACgQgU8IEzAA','','',event)"><div class="_nMg"><span class="_Mrh"></span><div class="_Orh">Website</div></div></a>
 
Last edited by a moderator:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi Tahor,

you could use two Instr() functions like so:
Code:
    startUrl = InStr(sDD, "url=")
    endUrl = InStr(sDD, "usg=")

    Debug.Print Mid(sDD , startUrl + 4, endUrl - startUrl - 4)
Hope that helps,
Koen
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,665
Members
449,462
Latest member
Chislobog

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