I have been working with some code for a while and literally, all of the sudden it broke on me. Here is the error message I'm getting:
Run-time error '-2147467259 (80004005)'
Automation error
Unspecified error
the line of code is specifically when instantiating an InternetExporer object, except I have done nothing to change the code. It just stopped working. What could be the issue?
This has happened before and I corrected it by explicitly calling the library (MSHTML for a HTMLBsaeObject before), except I'm using just an Object when naming the variables
Public Sub ValueLineResearch()
setUp
Dim myFund As String
loginN = Sheets("Logins").Range("B2").Text
pwStr = Sheets("Logins").Range("B3").Text
'Get the site
iEx.Navigate "https://jump.valueline.com/login.aspx"
iEx.Visible = True
Call waitForIE
'Need to login now don't we
iEx.Document.forms("aspnetForm").Item("ctl00_ContentPlaceHolder_LoginControl_txtUserID").Value = loginN
iEx.Document.forms("aspnetForm").Item("ctl00_ContentPlaceHolder_LoginControl_txtUserPw").Value = pwStr
iEx.Document.forms("aspnetForm").Item("ctl00_ContentPlaceHolder_LoginControl_btnLogin").Click
Call waitForIE
Application.Wait DateAdd("s", 6, Now)
iEx.Navigate "https://research.valueline.com/secure/research#sec=library"
Call waitForIE
For Each el1 In iEx.Document.getElementsByClassName("symbol-search textInput ui-autocomplete-input mod_search-symbols primary_symbol_search")
el1.Value = fundToResearch
Next
Application.Wait DateAdd("s", 2, Now)
iEx.Document.forms("quoteSearch").submit
Call waitForIE
Application.Wait DateAdd("s", 2, Now)
iEx.Navigate "https://research.valueline.com/secure/research#list=recent&sec=company&sym=" & fundToResearch
Call waitForIE
'store the Doc
Set ieDoc = iEx.Document
'For linkItem = 0 To ieDoc.Links.Length - 1
' 'Get the PDF
' If InStr(1, ieDoc.Links(linkItem).href, ".pdf", vbTextCompare) > 0 And InStr(1, ieDoc.Links(linkItem).href, "UserGuide", vbTextCompare) <= 0 Then
' ieDoc.Links(linkItem).Click
' iEx.Visible = True
' Exit For
' End If
'Next linkItem
Set iEx = Nothing
End Sub
And the setup sub is this:
set iEx = CreateObject("InternetExplorer.Application")
fundToResarch = LCase(InputBox("Please Enter a Fund"))