Facing "Object variable or With block variable not set"

Tejas Kore

Board Regular
Joined
Nov 2, 2017
Messages
72
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Facing the error on highlighted line. Selected proper object libraries. Please find the attached screenshot for selected libraries.

Rich (BB code):
Sub login_page()

Dim ieApp As InternetExplorer
Dim ieDoc As Object
'Dim ieTable As Object
'Dim clip As DataObject
Dim wb As Workbook
Dim ws As Worksheet
Dim doc As HTMLDocument


Set wb = ThisWorkbook
Set ws = wb.Sheets("Sheet1")

'create a new instance of ie
Set ieApp = New InternetExplorerMedium
'Set doc = ieApp.document

'you don’t need this, but it’s good for debugging
ieApp.Visible = True

ieApp.navigate "Company website"

Do
    DoEvents
Loop Until ieApp.readyState = READYSTATE_COMPLETE


ieApp.document.all("txtIP").Value = ws.Cells(2, 1).Value
ieApp.document.all("btnSearch").Click

Do
    DoEvents
Loop Until ieApp.readyState = READYSTATE_COMPLETE

Set ieDoc = ieApp.document
Dim sDD As String
sDD = ieDoc.getElementsByTagName("dd")(3).innerText
'MsgBox sDD
ws.Cells(2, 2) = sDD
ieApp.navigate "Company website"

End Sub

Tried to reference getElementsByTagName method directly "sDD = ieDoc.getElementsByTagName("dd")(3).innerText" like ieApp.document.getElementsByTagName("dd")(3).innerText but still error remains the same.
Error.PNG
Object Libraries.PNG
 
Last edited by a moderator:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Although it is hard to say something certain without seeing the actual HTML code, there must be at least 4 "dd" elements in the DOM according to your code:
sDD = ieDoc.getElementsByTagName("dd")(3)

What do you see if you put the following temporary code just above the failing code line?

VBA Code:
Msgbox(ieDoc.getElementsByTagName("dd").length)
 
Upvote 0
Although it is hard to say something certain without seeing the actual HTML code, there must be at least 4 "dd" elements in the DOM according to your code:
sDD = ieDoc.getElementsByTagName("dd")(3)

What do you see if you put the following temporary code just above the failing code line?

VBA Code:
Msgbox(ieDoc.getElementsByTagName("dd").length)
Hi Smozgur,

I added the message box as you said. There are 50 "dd" tags in the DOM.
 
Upvote 0
Then it might be something about the "dd" tag content since it obviously fails with the innerText property.

What does it return if you test the following ones (separately):
VBA Code:
Msgbox(ieDoc.getElementsByTagName("dd")(3).textContent)
Msgbox(ieDoc.getElementsByTagName("dd")(3).innerHTML)

Is this a private website, or one that you can't share the URL? It would be easy to debug if we had the HTML course.
 
Upvote 0
Hi Smozgur,

Tried with options .innerHTML and .innerContent but result remains the same.
Here is the html code [I tried to hide confidential information by starring it] . This is a internal website for CMDB which works only via VPN.

Trying to refer content of 4th "dd" tag. Would be great if there is another way

HTML:
<!DOCTYPE html>
<html>
<head>


</head>
<body>
  <form name="aspnetForm" method="post" action="./Item.aspx?iid=4402986" id="aspnetForm">
<div>

</div>


<div>

    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="fluid-container">
        <div class="navbar-header">
          <a href="/CMDB/" class="navbar-brand">********</a>
        </div>
        <div class="collapse navbar-collapse" id="mainNav">
        </div>
      </div>
    </nav>


    <ol class="breadcrumb">
  
    <li><a href="Search.aspx">CMDB</a></li><li><a href="item.aspx?iid=33">ROOT</a></li><li><a href="item.aspx?iid=1078">Clients</a></li><li><a href="item.aspx?iid=1221">******** Web</a></li><li><a href="item.aspx?iid=4402986">**************</a></li>


    </ol>


    <div class="container-fluid">
  
    <div class="row">
        <div id="maincontent" class="col-sm-10 col-sm-push-2">
        
        
            <h4>
                <span id="toolbar">
                    <a id="ctl00_cphContent_hypFLM" title="Find Like Me" href="search.aspx?t=153&amp;m=Virtual ******** Context&amp;a1=Virtual ******** Context&amp;a2=secondary&amp;a3=&amp;a4=&amp;a5=&amp;a6=&amp;a7=9.2&amp;a8="><img title="Find Like Me" src="images/penfold.gif" alt="[find like me]" style="border-width:0px;" /></a>
                    <a id="ctl00_cphContent_hypPwd" title="Find passwords for this configuration item" href="/deviceconsole/CI/4402986"><img title="Find passwords for this configuration item" src="images/key.gif" alt="[passwords]" style="border-width:0px;" /></a>
                </span>
                Main Properties
            </h4>
            <section id="primaryAttributes" class="attributes">
                <div class="row">
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Object Type</dt>
                            <dd>
                                *************&nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Object Status <span id="objectStatus" class="glyphicon glyphicon-calendar" style="margin-left: 7px; cursor: pointer;" title="View Item Lifecycle"></span></dt>
                            <dd>
                                Live&nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Last Update</dt>
                            <dd>
                                <span id="lblLastUpdate"></span>&nbsp;             
                                <input type="hidden" name="ctl00$cphContent$hdnLastUpdate" id="hdnLastUpdate" />
                            </dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Root Device</dt>
                            <dd>
                                <a id="ctl00_cphContent_hypRootID" title="Jump to this item" href="item.aspx?iid=4402986">*****************</a>&nbsp;</dd>
                        </dl>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Model</dt>
                            <dd>
                                Virtual ******** Context&nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Serial Number</dt>
                            <dd>
                                &nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Location <span id="locationTree" class="glyphicon glyphicon-tree-conifer" style="margin-left: 7px; cursor: pointer;" title="View Location Tree"></span></dt>
                            <dd>
                                Hosted By
                                <a href="item.aspx?iid=3932800">*************</a>
                                &nbsp;
                            </dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>
                            ServiceLevel
                    <dd>
                        Premium&nbsp;
                        </dl>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Management IP</dt>
                            <dd>
                                ******&nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Console IP</dt>
                            <dd>
                                &nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Device IP</dt>
                            <dd>
                                ********&nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Build MAC Address</dt>
                            <dd>
                                &nbsp;</dd>
                        </dl>
                    </div>
                </div>
                <div class="row">
                     <div id="ctl00_cphContent_managementIpv6Div" class="col-xs-6 col-sm-3">
                        <dl>
                            <dt id="dt-management-ip-v6-lbl">Management IPv6</dt>
                            <dd id="dd-management-ip-v6-txt">
                            
                            </dd>
                        </dl>
                    </div>


                    <div class="col-xs-6 col-sm-3">
                        <dl>
                            <dt>Time Zone</dt>
                            <dd>
                                &nbsp;</dd>
                        </dl>
                    </div>
                    <div class="col-xs-6 col-sm-3">
                    </div>
                    <div class="col-xs-6 col-sm-3">
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <dl>
                            <dt>Description</dt>
                            <dd>
                                MVP Secondary Mobile Back End ********</dd>
                        </dl>
                    </div>
                </div>
            </section>
            <section id="tabbedAttributes">
                <ul class="nav nav-tabs" role="tablist">
                    <li class="active"><a href="#objectAttributes" role="tab" data-toggle="tab">Object Attributes</a></li>
                    <li><a href="#businessAttributes" role="tab" data-toggle="tab">Business Attributes</a></li>
                    <li><a href="#systemAttributes" role="tab" data-toggle="tab">System Attributes</a></li>
                    <li><a href="#patchingRequirements" role="tab" data-toggle="tab">Patching</a></li>
                    <li><a href="#serverRestartRequirements" role="tab" data-toggle="tab">Server Restart</a></li>
                    <li><a href="#popupMessage" role="tab" data-toggle="tab">Popup Message</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="objectAttributes">
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        Model</dt>
                                    <dd>
                                        Virtual ******** Context</dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        Failover Role</dt>
                                    <dd>
                                        secondary</dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        Active IP</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        Passive IP</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        Serial Number</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        Asset Tag</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        ********</dt>
                                    <dd>
                                        9.2</dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        BandwidthReportsOn</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        HideFromClientPortal</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>
                                        </dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="businessAttributes">
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Asset Tag</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Business Owner</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Technical Owner</dt>
                                    <dd>
                                        ***********</dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Vendor</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Warranty Exp</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Warranty No.</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Owned By</dt>
                                    <dd>
                                        ********</dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Assignee Group</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <dl>
                                    <dt>Comments:</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <dl>
                                    <dt>Additional Billing Info:</dt>
                                    <dd>
                                        </dd>
                                </dl>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="systemAttributes">
                        <div class="row">
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Object ID</dt>
                                    <dd>
                                        4402986</dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>CI Type ID</dt>
                                    <dd>
                                        153</dd>
                                </dl>
                            </div>
                            <div class="clearfix visible-xs-block"></div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Scope</dt>
                                    <dd>
                                        Heathrow</dd>
                                </dl>
                            </div>
                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Discoverable</dt>
                                    <dd>
                                        True</dd>
                                </dl>
                            </div>
                        </div>
                        <div class="row">


                            <div class="col-xs-6 col-sm-3">
                                <dl>
                                    <dt>Last Discovery</dt>
                                    <dd>
                                        <span id="lblLastDiscovery"></span>
                                        <input type="hidden" name="ctl00$cphContent$hdnLastDiscovery" id="hdnLastDiscovery" value="/Date(1506924262993)\" />
                                    </dd>
                                </dl>
                            </div>                       
                        </div>
                    </div>
                    <div class="tab-pane" id="patchingRequirements">
                        No patching requirements have been specified for this configuration item.
                    </div>
                    <div class="tab-pane" id="serverRestartRequirements">
                        No server restart requirements have been specified for this configuration item.
                    </div>
                    <div class="tab-pane" id="popupMessage">
                        No popup text has been specified for this configuration item.
                    </div>
                </div>
            </section>
            <section id="relsAndRefs" class="row">
                <div class="col-sm-6">
                    <h4 class="sectiontitle">Relationships</h4>
                    <div id="relationships">
                    
                                <h5 onclick="viewRelationship('Business Services')">
                                    Business Services</h5>
                                <p id='Business Services' class="relationships" style="display: none;">
                                
                                            Is serviced by
                                            -
                                        
                                        
                                            <a id="ctl00_cphContent_rptrRelationshipClass_ctl00_rptrRelationships_ctl00_hypTarget" href="item.aspx?iid=2571532">***************</a>
                                        
                                        
                                            <br />
                                    
                                </p>
                        
                                <h5 onclick="viewRelationship('Network Devices')">
                                    Network Devices</h5>
                                <p id='Network Devices' class="relationships" style="display: none;">
                                
                                            Is hosted by
                                            -
                                        
                                        
                                            <a id="ctl00_cphContent_rptrRelationshipClass_ctl01_rptrRelationships_ctl00_hypTarget" href="item.aspx?iid=3932800">****************</a>
                                        
                                        
                                            <br />
                                    
                                            Is failover for
                                            -
                                        
                                        
                                            <a id="ctl00_cphContent_rptrRelationshipClass_ctl01_rptrRelationships_ctl01_hypTarget" href="item.aspx?iid=4402985">***********************)</a>
                                        
                                        
                                            <br />
                                    
                                </p>
                        
                    </div>
                </div>
                <div class="col-sm-4">
                    <h4 class="sectiontitle">References</h4>
                
                    <label></label>
                </div>
                <div class="col-sm-2">
                    <h4 class="sectiontitle">CI Domains</h4>
                
                    <br />
                    <h4 class="sectiontitle">Client Domains</h4>
                
                            secSupportDomain_UK
                            <br />
                    
                            secSupportDomain_US
                            <br />
                    
                            secSupportDomain_PL
                            <br />
                    
                            secSupportDomain_DE
                            <br />
                    
                            secSupportDomain_IN
                            <br />
                    
                            secSupportUsageBilling_IN
                            <br />
                    
                            secSupportUsageProjects_Global
                            <br />
                    
                    <br />
                </div>
            </section>
        </div>
        <div id="sidebar" class="col-sm-2 col-sm-pull-10">


            <!-- quicksearch -->
            <div id="quicksearch">
                <h4>Item Quicksearch</h4>
                <div class="input-group">
                    <input name="ctl00$cphContent$txtQuickSearch" type="text" maxlength="128" id="ctl00_cphContent_txtQuickSearch" class="form-control input-sm" />
                    <span class="input-group-btn">
                        <input type="submit" name="ctl00$cphContent$btnQuickSearch" value="Go" id="ctl00_cphContent_btnQuickSearch" class="btn btn-default btn-sm" />
                    </span>
                </div>
                [<a href="search.aspx">Advanced Search</a>]
            </div>


            <ul class="nav nav-tabs nav-justified">
                <li class="active"><a href="#navigation" role="tab" data-toggle="tab">Navigation</a></li>
                <li><a href="#tools" role="tab" data-toggle="tab">Tools</a></li>
            </ul>


            <div class="tab-content">
                <div class="tab-pane active" id="navigation">
                    <div id="navtree" style="display: block;">
                        <a id="ctl00_cphContent_hypParent" class="navparent" href="item.aspx?iid=1221">******** Web</a>
                        <span id="ctl00_cphContent_lblName" class="navitem">****************</span>
                    
                    
                    </div>


                </div>
                <div class="tab-pane" id="tools">
                    <div class="navitem">
                        Main Tools
                    </div>
                    <a onclick="return deleteMe(4402986,1221);" id="ctl00_cphContent_btnDelete" disabled="disabled" class="navchild">Delete this item</a>
                    <a id="ctl00_cphContent_hypEditItem" class="navchild" href="itemedit.aspx?iid=4402986">Edit this item</a>
                    <a id="ctl00_cphContent_hypMoveItem" class="navchild" href="javascript:moveItem();">Move this item</a>
                    <a id="ctl00_cphContent_hypAddChild" class="navchild" href="itemedit.aspx?pid=4402986">Add child object</a>
                    <a id="ctl00_cphContent_hypBulkInsert" class="navchild" href="bulkinsert.aspx?pid=4402986">Bulk insert</a>
                    <a id="ctl00_cphContent_hypCompareItem" class="navchild" href="Comparison.aspx?iid=4402986">Item Comparison</a>
                    <a id="ctl00_cphContent_hypAddChange" class="navchild" href="changeedit.aspx?iid=4402986">Add change</a>
                    <a id="ctl00_cphContent_btnDomains" disabled="disabled" class="navchild" data-toggle="modal" data-target="#dialogDomainSelection">Domains</a>
                    <div class="navitem">
                        Attributes
                    </div>
                    <a id="ctl00_cphContent_hypChildStatus" class="navchild" href="itemchildstatus.aspx?iid=4402986">Child statuses</a>
                    <a id="ctl00_cphContent_hypItemChanges" class="navchild" href="itemchanges.aspx?iid=4402986">Item changes</a>
                    <a id="ctl00_cphContent_hypAuditHistory" class="navchild" href="itemaudithistory.aspx?iid=4402986">Audit history</a>
                    <a id="ctl00_cphContent_hypAddLabel" disabled="disabled" class="navchild">Add audit label</a>
                    <div class="navitem">
                        Relationships &amp; References
                    </div>
                    <a id="ctl00_cphContent_hypEditRelationships" class="navchild" href="itemrelationships.aspx?iid=4402986">Edit relationships</a>
                    <a id="ctl00_cphContent_hypEditReferences" class="navchild" href="itemreferences.aspx?iid=4402986">Edit references</a>
                </div>


            </div>
        </div>
    </div>


    <!--RAD Window for Extended Attributes Popup-->
    <div id="ctl00_cphContent_RadWindowManager1" style="display:none;">
    <!-- 2014.2.618.40 --><div id="ctl00_cphContent_itemMoveWindow" style="display:none;">
        <div id="ctl00_cphContent_itemMoveWindow_C" style="display:none;">


        </div><input id="ctl00_cphContent_itemMoveWindow_ClientState" name="ctl00_cphContent_itemMoveWindow_ClientState" type="hidden" />
    </div><div id="ctl00_cphContent_RadWindowManager1_alerttemplate" style="display:none;">
        <div class="rwDialogPopup radalert">       
            <div class="rwDialogText">
            {1}           
            </div>
        
            <div>
                <a  onclick="$find('{0}').close(true);"
                class="rwPopupButton" href="javascript:void(0);">
                    <span class="rwOuterSpan">
                        <span class="rwInnerSpan">##LOC[OK]##</span>
                    </span>
                </a>           
            </div>
        </div>
        </div><div id="ctl00_cphContent_RadWindowManager1_prompttemplate" style="display:none;">
         <div class="rwDialogPopup radprompt">       
                <div class="rwDialogText">
                {1}           
                </div>   
                <div>
                    <input title="Enter Value" onkeydown="return RadWindowprompt_detectenter('{0}', event, this);" type="text"  class="rwDialogInput" value="{2}" />
                </div>
                <div>
                    <a onclick="$find('{0}').close(this.parentNode.parentNode.getElementsByTagName('input')[0].value);"           
                        class="rwPopupButton" href="javascript:void(0);" ><span class="rwOuterSpan"><span class="rwInnerSpan">##LOC[OK]##</span></span></a>
                    <a onclick="$find('{0}').close(null);" class="rwPopupButton"  href="javascript:void(0);"><span class="rwOuterSpan"><span class="rwInnerSpan">##LOC[Cancel]##</span></span></a>
                </div>
            </div>                   
        </div><div id="ctl00_cphContent_RadWindowManager1_confirmtemplate" style="display:none;">
        <div class="rwDialogPopup radconfirm">       
            <div class="rwDialogText">
            {1}           
            </div>                   
            <div>
                <a onclick="$find('{0}').close(true);"  class="rwPopupButton" href="javascript:void(0);" ><span class="rwOuterSpan"><span class="rwInnerSpan">##LOC[OK]##</span></span></a>
                <a onclick="$find('{0}').close(false);" class="rwPopupButton"  href="javascript:void(0);"><span class="rwOuterSpan"><span class="rwInnerSpan">##LOC[Cancel]##</span></span></a>
            </div>
        </div>   
        </div><input id="ctl00_cphContent_RadWindowManager1_ClientState" name="ctl00_cphContent_RadWindowManager1_ClientState" type="hidden" />
</div>


    <!-- dialogs -->
    <div id="dialogDelete" title="Delete Configuration Item" style="display: none;" role="dialog">
        <p>Do you wish to delete this object?</p>
        <p>This operation cannot be undone.</p>
    </div>


    <div id="dialogPleaseWait" title="Please Wait" style="display: none; text-align: center;" role="dialog">
        <p>Please wait while this operation completes</p>
        <p>
            <img src="Images/pleaseWait.gif" alt="Please Wait" title="Please Wait" />
        </p>
    </div>


    <div id="dialogLifecycle" class="modal fade" role="dialog">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h3 class="modal-title">Lifecycle Events</h3>
                </div>
                <div class="modal-body">
                    <p id="dialogLifecycle_noData" style="display: none;">No lifecycle events were found for this item.</p>
                    <div id="dialogLifecycle_dataHeader" class="lifecycleHeader row">
                        <div class="col-xs-1">Date</div>
                        <div class="col-xs-3">Implementor</div>
                        <div class="col-xs-4">Event Description</div>
                        <div class="col-xs-2">Value</div>
                        <div class="col-xs-2">RFC/Deploy Code</div>
                    </div>
                    <div id="dialogLifecycle_dataBody"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>


    <div id="dialogLocationTree" class="modal fade" role="dialog">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h3 class="modal-title">Location Tree</h3>
                </div>
                <div class="modal-body">
                    <p id="dialogLocationTree_noData" style="display: none;">No location data was found for this item.</p>
                    <div id="dialogLocationTree_dataBody"></div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>
    <div id="dialogDomainSelection" class="modal fade" role="dialog">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h3 class="modal-title">Add/Remove Domains</h3>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-5">
                            <div class="panel panel-default">
                                <div class="panel-heading">Avaliable domains</div>
                                <div class="panel-body">
                                    <select size="10" name="ctl00$cphContent$lstDomains" multiple="multiple" id="ctl00_cphContent_lstDomains" style="width:100%;">
    <option value="1">*********</option>
    <option value="2">*********</option>
    <option value="3">*********</option>
    <option value="4">*********</option>
    <option value="5">*********</option>
    <option value="6">*********</option>
    <option value="7">*********</option>
    <option value="8">*********</option>


</select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-2 pull-bottom">
                            <button type="button" id="btnAdd" class="btn btn-default btn-block disabled">Add</button>
                            <button type="button" id="btnRemove" class="btn btn-default btn-block disabled">Remove</button>
                            <button type="button" id="btnAddAll" class="btn btn-default btn-block">Add All</button>
                            <button type="button" id="btnRemoveAll" class="btn btn-default btn-block">Remove all</button>
                        </div>
                        <div class="col-md-5">
                            <div class="panel panel-default">
                                <div class="panel-heading">Selected domains</div>
                                <div class="panel-body">
                                    <select size="10" name="ctl00$cphContent$lstCIDomains" multiple="multiple" id="ctl00_cphContent_lstCIDomains" style="width:100%;">


</select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="btnUpdateUserdomains">Save</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>


    </div>


    <footer>
      <p>© 2017 ******** Limited</p>
    </footer>

</form>
</body>
</html>
 
Last edited by a moderator:
Upvote 0
Could you please test the following code lines together?

VBA Code:
MsgBox(iedoc.getElementById("primaryAttributes").getElementsByTagName("dd").length)
MsgBox(iedoc.getElementById("primaryAttributes").getElementsByTagName("dd")(3).innerText)
 
Upvote 0
I should have explained why I asked for the latest test.

The current HTML has no problem, the elements are existing and programmatically accessible in the DOM.
Your references and the related code have no issues, and they work as they are supposed to be in my test environment.

One thing I can think of now: the dynamic content that might be loaded via JavaScript after the HTML code transfer is completed.
By executing the latest code I sent in my previous code, we will test if we can access the dd objects by also using the parent object with primaryAttributes id. It is supposed to return the total dd object count, then the text content of the 4th object.

I hope it makes sense.
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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