VBA help | INFJ Forum

VBA help

Discussion in 'Computer Science' started by dogman6126, Apr 30, 2015.

Share This Page

More threads by dogman6126
  1. dogman6126

    dogman6126 Community Member

    Joined:
    May 9, 2014
    Threads:
    28
    Messages:
    811
    Likes Received:
    213
    Trophy Points:
    602
    Gender:
    Male
    MBTI:
    ENFJ-wasINFJ
    Does anyone on here know VBA? I need help understanding why a Macro I wrote in excel isn't working right. This program is supposed to take what is in Cells(2, 7), run a google search, collect the resultstats, and record those stats in Cells(2, 4). Then shift down one line and run again until the cell is empty. The problem is I run into error 80070005, which from what I've read is because google doesn't let you do a lot of searches at a time. To get around this, I'm trying to program the code to on error change the XMLHTTP object and continue on the list. However, I keep running into an overflow error on the ErrCount = ErrCount + 1. I'm not sure why or how to avoid it. I'm only just now learning VBA, so I could really use some help. Any thoughts?

    here's the code:



     
  2. rawr

    rawr ¯\_(ツ)_/¯

    Joined:
    Jan 17, 2010
    Threads:
    123
    Messages:
    7,296
    Featured Threads:
    1
    Likes Received:
    2,389
    Trophy Points:
    867
    Gender:
    Male
    Location:
    Earth
    MBTI:
    IxTP
    Enneagram:
    human
    wrong place.

    go use stackexchange
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Grayman

    Grayman Community Member

    Joined:
    Nov 9, 2013
    Threads:
    9
    Messages:
    528
    Likes Received:
    92
    Trophy Points:
    572
    MBTI:
    LOGIC
    Not certain about that, but you initiated errorcount with a starting value of 1 but then on an error it adds one before getting to the "If ErrCount = 1 Then Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")" so that by the time it gets here the errorcount is 2 and the CreateObject("MSXML2.XMLHTTP") is never called.
     
  4. OP
    dogman6126

    dogman6126 Community Member

    Joined:
    May 9, 2014
    Threads:
    28
    Messages:
    811
    Likes Received:
    213
    Trophy Points:
    602
    Gender:
    Male
    MBTI:
    ENFJ-wasINFJ
    That was because MSXML2.XMLHTTP is already called in the regular code. I thought of a different way of doing this that avoided using the error handle by creating a RunCounter that counted after every run through the loop, and set if Then statements on each HTML object to trigger on multiples of 1 + 5x, but I'm still trying to figure how to code that properly. Back to reading :/
     
    #4 dogman6126, May 1, 2015
    Last edited: May 2, 2015
  5. OP
    dogman6126

    dogman6126 Community Member

    Joined:
    May 9, 2014
    Threads:
    28
    Messages:
    811
    Likes Received:
    213
    Trophy Points:
    602
    Gender:
    Male
    MBTI:
    ENFJ-wasINFJ
    I'm asking for help there too, but I was hoping some INFJs might know some computer lingo and be willing to help out :m097:


    EDIT:
    Here's the link to stackexchange where I asked for help. The information there is more detailed.
    In case anyone wants to help....No one there has said anything on my post yet :/

    http://stackoverflow.com/questions/...oogle-collect-resultstats-error-code-80070005
     
    #5 dogman6126, May 1, 2015
    Last edited: May 2, 2015
  6. OP
    dogman6126

    dogman6126 Community Member

    Joined:
    May 9, 2014
    Threads:
    28
    Messages:
    811
    Likes Received:
    213
    Trophy Points:
    602
    Gender:
    Male
    MBTI:
    ENFJ-wasINFJ
    If anyone is interested in helping out, here's my newest attempt at the code. I added the If/End If statements and the XMLRun ="X" to try to track what object is being used.

    If anyone has some tips, I could really use some. If no one wants/has time to help with this, then I'll stop posting here after this comment.
    Thanks
     
Loading...

Share This Page