Sharid
Well-known Member
- Joined
- Apr 22, 2007
- Messages
- 1,066
- Office Version
- 2016
- Platform
- Windows
I have this code that takes data from a html element by Id, the ID in this case is "MainBody_lblBankDetails" It then displays it in a message box.
This is the HTML that it takes it from
What i need is a code like this but works a bit different.
1) No message box, data is displayed in sheet1 column A
2) The result will show in the next blank rows as i will be using a list of url from sheet2, (I already haev the code to get urls from sheet2)
3) The above code searchs an element via ID in a div. My problem is there is no element ID just a div, the div class in this case is "bio"
T
he data is only text. I have tried to change the code but I am having no luck.
Can someone help please
Code:
Private Sub CommandButton7_Click()
With CreateObject("InternetExplorer.Application")
.navigate "http://swiftcode.a1feeds.com/Swift_Code.aspx?Swift_Code=ATBRCA6EXXX"
Do
DoEvents
Loop Until .readyState = 4
MsgBox .document.getElementById("[B]MainBody_lblBankDetails[/B]").innerText
End With
End Sub
This is the HTML that it takes it from
HTML:
<div class="BlueBox1">
<span id="MainBody_lblBankDetails"><b>Bank : </b>ALBERTA TREASURY BRANCHES<br /><b>City : </b>EDMONTON<br /><b>SWIFT Code : </b>ATBRCA6EXXX</span>
</div>
What i need is a code like this but works a bit different.
1) No message box, data is displayed in sheet1 column A
2) The result will show in the next blank rows as i will be using a list of url from sheet2, (I already haev the code to get urls from sheet2)
3) The above code searchs an element via ID in a div. My problem is there is no element ID just a div, the div class in this case is "bio"
HTML:
<div class="bio">
More Information contact : XXXXX XXXXX XXXXX Social : https://www.facebook.com/
</div>
he data is only text. I have tried to change the code but I am having no luck.
Can someone help please
Last edited: