'get the table based on the table’s id
Set ieDoc = ieApp.Document
Set ieTable = ieDoc.all.Item("contentBody")
'copy the tables html to the clipboard and paste to teh sheet
If Not ieTable Is Nothing Then
Set clip = New DataObject
clip.SetText "<table>" & ieTable.innerHTML & "</table>"
clip.PutInClipboard
Sheet1.Select
Sheet1.Range("A1").Select
Sheet1.PasteSpecial "Unicode Text"
End If
I've played with the code above and know there's a better way. the "contentBody" includes:
<div id="contentBody">
<div id="breadcrumb_navigation">
<ul class="nav nav-pills" style="margin-bottom: 0px;">
<h2 class="leftShim">Base Statistics</h2>
<div style="margin: 0px 15px 15px;">
<table class="table table-striped">
</div>
<br/>
<br/>
</div>
All I want out of this is the table that is <table class="table table-stripe">
But because of my lack of knowledge I'm not sure where to start trimming out the excess or if I should try another approach.
For this example the navigation, search and breadcrumb from the website gets pulled into my worksheet. I've grabbed data before using HTML tags, but only pieces of data and never an entire table and I'm currently left here just shrugging.