Results 1 to 11 of 11

macro errors out

Threaded View

Pancho3 macro errors out 06-20-2014, 01:54 PM
6StringJazzer Re: macro errors out 06-20-2014, 03:57 PM
Sean Thomas Re: macro errors out 06-21-2014, 06:12 AM
Pancho3 Re: macro errors out 06-23-2014, 05:15 PM
6StringJazzer Re: macro errors out 06-23-2014, 08:23 PM
Pancho3 Re: macro errors out 06-24-2014, 06:59 PM
Sean Thomas Re: macro errors out 06-24-2014, 03:09 AM
Pancho3 Re: macro errors out 06-24-2014, 07:03 PM
Sean Thomas Re: macro errors out 06-24-2014, 03:29 AM
6StringJazzer Re: macro errors out 06-24-2014, 08:33 AM
Sean Thomas Re: macro errors out 06-25-2014, 01:57 AM
  1. #1
    Registered User
    Join Date
    09-08-2008
    Location
    Elk Grove, California
    Posts
    21

    macro errors out

    When running the enclosed macro, I receive a Object variable or With block variable not set, error Line <code> trlen = tr.ChildNodes.Length <code>

    any help or suggestions would be appreciated.



    Sub RotoWire_Pitchers()
        Dim k As Integer
        Dim trlen As Long
        Dim i As Long
        Dim j As Integer
        Dim tr As Object
        Dim th As Object
        Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")
        Dim XMLHttpRequest As MSXML2.XMLHTTP
        
        Dim URLa As String
        Dim HTMLDoc As HTMLDocument
        'On Error Resume Next
        Application.Calculation = xlCalculationManual
        Application.ScreenUpdating = False
           
           
        Sheets("PITCHER REPORT").Select
        
        URLa = "http://www.rotowire.com/baseball/player_stats.htm?league=3&pos=P&filter=A"
        
        Set XMLHttpRequest = New MSXML2.XMLHTTP
        XMLHttpRequest.Open "GET", URLa, False
        XMLHttpRequest.send
        
        Set HTMLDoc = New HTMLDocument
        HTMLDoc.body.innerHTML = XMLHttpRequest.responseText
        Set tr = HTMLDoc.getElementsByTagName("tbody")(91)
        trlen = tr.ChildNodes.Length
        'Range("A1").Value = trlen
        For i = 1 To trlen - 1
            tdlen = 20
                For j = 0 To tdlen - 1
                    Cells(i + 1, j + 2).Value = tr.ChildNodes(i).ChildNodes(j).innerText
                    Next j
        Next i
        
     Set tr = Nothing
     Set HTMLDoc = Nothing
     
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
    End Sub
    Last edited by Pancho3; 06-20-2014 at 03:19 PM. Reason: code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need Help with a Macro that errors out
    By missmea2005 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-30-2012, 11:00 AM
  2. Macro Error, No Clue Why this macro errors.
    By donnydorko in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-06-2009, 04:45 PM
  3. [SOLVED] Excel Throwing Circular Errors When No Errors Exist
    By MDW in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-10-2006, 09:20 AM
  4. Macro Errors
    By fugfug in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2005, 10:05 AM
  5. [SOLVED] Macro Errors
    By julia.stone@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-26-2005, 05:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1