Compile Error Object Library Feature Not Supportted

mrmmickle1

Well-known Member
Joined
May 11, 2012
Messages
2,461
I have been using this code to login quicker at my work for months and recently it has begun breaking on this line
Rich (BB code):
 Set htmlDoc = .Document
Does anyone know what may have happened or how to fix this problem? The error I get is Compile Error Object library feature is not supported. Here is the full sub:
Rich (BB code):
Option Explicit
 Sub Workbook_Open()
     
     
     'make sure you add references to Microsoft Internet Controls (shdocvw.dll) and
     'Microsoft HTML object Library.
     'Code will NOT run otherwise.
    Dim IE As Object
    Dim objIE As SHDocVw.InternetExplorer 'microsoft internet controls (shdocvw.dll)
    Dim htmlDoc As MSHTML.HTMLDocument 'Microsoft HTML Object Library
    Dim htmlInput As MSHTML.HTMLInputElement
    Dim htmlColl As MSHTML.IHTMLElementCollection
     
    Set objIE = New SHDocVw.InternetExplorer
     
    With objIE
        .Navigate "https://www.paycomonline.net/v4/ee/ee-login.php" ' Main page
        .Visible = 1
        Do While .READYSTATE <> 4: DoEvents: Loop
            Application.Wait (Now + TimeValue("0:00:02"))
            
             'set user name and password
            Set htmlDoc = .Document
            Set htmlColl = htmlDoc.getElementsByTagName("INPUT")
            Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop
                For Each htmlInput In htmlColl
                    If htmlInput.Name = "username" Then
                        htmlInput.Value = "Value 1"
                    Else
                        If htmlInput.Name = "userpass" Then
                            htmlInput.Value = "Value 2"
                    Else
                        If htmlInput.Name = "userpin" Then
                            htmlInput.Value = "Value 3"
                            
                            
                            End If
                        End If
                     End If
                Next htmlInput
                 
              'click login
                Set htmlDoc = .Document
                Set htmlColl = htmlDoc.getElementsByTagName("input")
                Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop
                    For Each htmlInput In htmlColl
                        If Trim(htmlInput.Type) = "submit" Then
                            htmlInput.Click
                            Exit For
                        End If
                    Next htmlInput
                End With
            Application.Quit
          End Sub
 
Have you checked (Tools>References...) that the references mentioned in the code are sill set?
 
Upvote 0
Norie, I checked the references and found two extras that were not needed. For some reason I had referenced OLE Automation and Microsoft Office 14.0 Object Library. Once I removed these two references the sub works again. Thank you for pointing out the error. I appreciate your input as always. -Matt
 
Upvote 0
Norie, I checked the references and found two extras that were not needed. For some reason I had referenced OLE Automation and Microsoft Office 14.0 Object Library. Once I removed these two references the sub works again. Thank you for pointing out the error. I appreciate your input as always. -Matt

I followed your advice, and dereferenced OLE Automation (I am using Microsoft Office 14.0 Object Library so it was left on) and compiling passed. Than, I re-referenced OLE Automation, and still works.

Just to be sure, I was thinking maybe order of references are the in question, so I put OLE Automation up in the list (as it was when the error occurred) - but error did not reappear.

So, my conclusion is: just de-reference, then re-reference OLE Automation - it worked for me.

Thank you
 
Upvote 0
I followed your advice, and dereferenced OLE Automation (I am using Microsoft Office 14.0 Object Library so it was left on) and compiling passed. Than, I re-referenced OLE Automation, and still works.

Just to be sure, I was thinking maybe order of references are the in question, so I put OLE Automation up in the list (as it was when the error occurred) - but error did not reappear.

So, my conclusion is: just de-reference, then re-reference OLE Automation - it worked for me.

Thank you

I'm Sign Up in the MrExcel.com only to say thank you, it´s working for me...

I upgrade to Windows 10 and my code IE.Document just stop to working, I´m only order the "Microsoft HTML Object Library" at the top of "OLE Automation" and the Sub Works.
 
Upvote 0

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