title: Excel Visual Basic variable as HTMLDocument
body: <p>A user has sent me a macro that is no longer working and the developer has since retired.  When I look at the variables, one is declared as follows:</p>
  
  <pre><code>Public WebDoc As HTMLDocument
  </code></pre>
  
  <p>When I run the macro, it errors out on the line below:</p>
  
  <pre><code>For p = 1 To y
  
   vWBCount = Workbooks.Count
  
   With ExpApp
  
       .navigate vPath
  
        Do Until .readyState = READYSTATE_COMPLETE
            MyTimer
        Loop
  
        Set WebDoc = .document    ''''THIS IS THE LINE THROWING THE ERROR
  
        For Each IElem In WebDoc.forms(0).elements
  
                  Select Case IElem.Name
                      Case "InputKeys_BUSINESS_UNIT"
                          IElem.Value = vBU(p)
  
                      Case "InputKeys_bind2"
                          IElem.Value = vBegDate
  
                      Case "InputKeys_bind3"
                          IElem.Value = vEndDate
  
                      Case "InputKeys_VENDOR_ID"
                          IElem.Value = vVendor(p)
  
                  End Select
              Next
  
              .navigate vSubmit
  
              Do Until .readyState = READYSTATE_COMPLETE
                  Call LookForAndCloseIEPopup
                  MyTimer
              Loop
  </code></pre>
  
  <p>The error message says:</p>
  
  <blockquote>
    <p>Object library feature not supported</p>
  </blockquote>
  
  <p>Any suggestions on how to fix this would be appreciated.  The macro is being run on Windows 7 / Office 2010 / Visual Basic.</p>
  
  <p>Thanks......</p>