2017-06-08 44 views
0

單擊某個選項卡上的網站下面是網站上的標籤是什麼樣子: tabsHTML - 使用Microsoft Access VBA通​​過IE

當他們點擊它激活數據的不同桌子底下。

我正在嘗試激活RIGS選項卡。以下是包括在圖片的所有選項卡的HTML代碼:

<ul class="nav nav-tabs di-nav-tabs" ng-class="{'show-scroll': tabsNeedScroll}"> 
    <!-- ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><li ng-repeat="tab in tabState.tabs" ng-class="{active: tab.active, disabled: tab.disabled}" ng-if="isDatasourceVisible(tab.datasourceId)" class="ng-scope"> 
    <a href="" ng-click="select(tab)" class="ng-binding"> 
     <!-- ngIf: tab.group==='International' --> 
     Leases 
    </a> 
    </li><!-- end ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><li ng-repeat="tab in tabState.tabs" ng-class="{active: tab.active, disabled: tab.disabled}" ng-if="isDatasourceVisible(tab.datasourceId)" class="ng-scope active" style=""> 
    <a href="" ng-click="select(tab)" class="ng-binding"> 
     <!-- ngIf: tab.group==='International' --> 
     Production 
    </a> 
    </li><!-- end ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><li ng-repeat="tab in tabState.tabs" ng-class="{active: tab.active, disabled: tab.disabled}" ng-if="isDatasourceVisible(tab.datasourceId)" class="ng-scope"> 
    <a href="" ng-click="select(tab)" class="ng-binding"> 
     <!-- ngIf: tab.group==='International' --> 
     Wells 
    </a> 
    </li><!-- end ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><li ng-repeat="tab in tabState.tabs" ng-class="{active: tab.active, disabled: tab.disabled}" ng-if="isDatasourceVisible(tab.datasourceId)" class="ng-scope"> 
    <a href="" ng-click="select(tab)" class="ng-binding"> 
     <!-- ngIf: tab.group==='International' --> 
     Permits 
    </a> 
    </li><!-- end ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><li ng-repeat="tab in tabState.tabs" ng-class="{active: tab.active, disabled: tab.disabled}" ng-if="isDatasourceVisible(tab.datasourceId)" class="ng-scope" style=""> 
    <a href="" ng-click="select(tab)" class="ng-binding"> 
     <!-- ngIf: tab.group==='International' --> 
     Rigs 
    </a> 
    </li><!-- end ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><li ng-repeat="tab in tabState.tabs" ng-class="{active: tab.active, disabled: tab.disabled}" ng-if="isDatasourceVisible(tab.datasourceId)" class="ng-scope"> 
    <a href="" ng-click="select(tab)" class="ng-binding"> 
     <!-- ngIf: tab.group==='International' --> 
     Landtrac Lease 
    </a> 
    </li><!-- end ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><li ng-repeat="tab in tabState.tabs" ng-class="{active: tab.active, disabled: tab.disabled}" ng-if="isDatasourceVisible(tab.datasourceId)" class="ng-scope"> 
    <a href="" ng-click="select(tab)" class="ng-binding"> 
     <!-- ngIf: tab.group==='International' --> 
     Landtrac Unit 
    </a> 
    </li><!-- end ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --><!-- ngIf: isDatasourceVisible(tab.datasourceId) --><!-- end ngRepeat: tab in tabState.tabs --> 

    <li ng-class="{active: shapefileTableInfo.active, disabled: shapefileTableInfo.disabled}" ng-show="hasShapefiles()" class="" style=""> 
    <a href="" ng-click="select(shapefileTableInfo)">Shapefiles</a> 
    </li> 
</ul> 

我已經嘗試了許多方法來激活鑽機標籤和沒有做的伎倆。有沒有人有什麼建議?

+0

「我嘗試了很多方法」 - 通常最好顯示您嘗試的代碼,並描述當您運行它時發生了什麼。 –

+0

感謝您的回覆Tim。我同意這是最好的做法,但我一直在加入並逐步進行測試,當它不起作用時,我繼續嘗試其他方法。我會追查我嘗試過的一些例子。我希望有一個明顯的解決方案,因爲我不太瞭解HTML。再次感謝您的回覆 –

+0

類似於'doc.getElementsByTagName(「a」)。getElementsByClassName(「ng-binding」)'得到所有的選項卡,然後遍歷該集合以找到一個元素,其innerText包含「Rigs 「 –

回答

0

我無法真正弄清楚語法。它是否讀取「生產」?

Sub DownloadData() 

Dim lColumn As Long 
Dim iCntr As Long 
Dim ws As Worksheet 
Dim rwsToCheck As Long 
Dim MyRange As Range 
Dim iCounter As Long 
Dim LastRow As Long 
Dim LastColumn As Long 

Set ie = CreateObject("InternetExplorer.application") 


With ie 
    .Visible = True 
    .navigate "your_url_here" 

' Wait for the page to fully load; you can't do anything if the page is not fully loaded 
Do While .Busy Or _ 
    .readyState <> 4 
    DoEvents 
Loop 


For Each Anchor In ieAnchors 
    If Anchor.innerHTML Like "*Production*" Then 
     Anchor.Click 
     Exit For 
    End If 
Next Anchor 


End Sub