Excel Visual Basic variable as HTMLDocument

10.4k Views Asked by At

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:

Public WebDoc As HTMLDocument

When I run the macro, it errors out on the line below:

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

The error message says:

Object library feature not supported

Any suggestions on how to fix this would be appreciated. The macro is being run on Windows 7 / Office 2010 / Visual Basic.

Thanks......

1

There are 1 best solutions below

1
Md. Jahurul Islam On

Use .readyState = 4 instead of .readyState = READYSTATE_COMPLETE. They refer to the same readyState status.