Internet Explorer Runtime Error 91
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up VBA Runtime Error 91 Object Variable Not Set - What am I doing wrong? up vote 1 down vote favorite I am trying to get data from internet to Excel spreadsheet. Namely, I want the names of the AP Top 25 NCAAF teams from past 12 years, for all 17 weeks of the season (including final rankings). My code is based off this tutorial: https://www.youtube.com/watch?v=7sZRcaaAVbg I'm getting the error at the line: SchoolNames(iYear, iWeek, iRank) = Trim(Doc.getElementsByTagName("school")(iRank - 1).innerText) Here's my code: Option Explicit Sub Data_Collection() Application.ScreenUpdating = False Dim iYear As Integer Dim iWeek As Integer Dim IE As New InternetExplorer Dim sYear As String Dim sWeek As String Dim SchoolNames(12, 17, 25) As String Dim Doc As HTMLDocument Dim iRank As Integer For iYear = 2002 To 2013 sYear = CStr(iYear) For iWeek = 1 To 17 If iWeek = 17 Then sWeek = "1/seasontype/3" Else sWeek = CStr(iWeek) End If IE.Visible = False IE.navigate "http://espn.go.com/college-football/rankings/_/poll/1/year/" & sYear & "/week/" & sWeek Do DoEvents Loop Until IE.readyState = READYSTATE_COMPLETE Set Doc = IE.Document For iRank = 1 To 25 SchoolNames(iYear, iWeek, iRank) = Trim(Doc.getElementsByTagName("school")(iRank - 1).innerText) Next iRank Next iWeek Next iYear End Sub Additionally, I'm not sure even after I fix the Runtime 91 error that I am passing the right stuff
example, runtime error 91 is a program error that displays the “Object variable set to Nothing” message. Causes of Runtime 91 Errors This particular error is related to Visual Studio and the .NET Framework which are tools used by software developers to develop applications. Runtime error 91 tells the developer that an invalid variable is being referenced within the code; in this case, the variable has been set to “nothing.” How to Fix Runtime Error 91 When you encounter a program that generates runtime error 91, there’s not http://stackoverflow.com/questions/22057347/vba-runtime-error-91-object-variable-not-set-what-am-i-doing-wrong much that you can personally do about the program’s underlying code. However, you can check to see if the developer has since changed the code to fix this bug. If so, you can then update your software and apply the fix. Do this by using the program’s built in update utility if available. If a built-in “check for updates” tool is not available, you http://www.runtimeerrorsfix.com/how-to-fix-runtime-error-91.html will need to go to the software developer’s website and check for software updates. While you are at it, it’s not a bad idea to check for Windows updates as well. Not only do software developers patch their products when bugs are discovered, Microsoft also updates the Windows operating system. If your computer is a model from a manufacturer and the software generating the runtime error 91 came preinstalled on your computer, you can also check for updates specific to your model at the manufacturer’s website. This is a terrific way to find updates for your exact model in one location. You may find software updates that solve your runtime error as well as additional updates that you were otherwise unaware of. By keeping your computer updated with the latest software and hardware patches, you can solve current problems as well as prevent future ones. How to Turn off Error 91 Messages What if the software developer hasn’t released a fix for the runtime error 91? The first thing to do is report the issue to the developer who may not be aware of it. Next, you
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in Availability Office Add-ins Changelog Microsoft https://msdn.microsoft.com/en-us/library/office/gg264837.aspx Graph API Office 365 Connectors Office 365 REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Office VBA language reference Visual Basic language reference Error Messages Error Messages Object variable not set (Error 91) Object variable not set (Error 91) Object variable not set (Error 91) #Else clause must be preceded by a matching #If #Else If, #Else, internet explorer or #End If must be preceded by a matching #If #ElseIf must be preceded by a matching #If or #ElseIf and followed by an #ElseIf, #Else, or #End If