Object Variable or with block variable not set ERROR in VBA

Please see attached.

a.png
the error is in line
Set eleColtr = htmlTables(intTableIndex).getElementsByTagName("tr")

Open in new window

Book1.xlsb
LVL 6
FloraAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertFabrice LambertCommented:
Instead of creating an Internet Explorer object, you'd better make a form with a web browser object, and catch the DocumentComplete event.

There is an article on MSDN:
https://support.microsoft.com/en-us/help/180366/how-to-determine-when-a-page-is-done-loading-in-webbrowser-control
0
FloraAuthor Commented:
Fabrice,

thanks, but led me on a wild-goose chase.  i cannot debug the code which i have and yet, how would i use the information on the link you shared.
0
Martin LissOlder than dirtCommented:
i cannot debug the code which i have...
Do you mean that you don't know how?
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

FloraAuthor Commented:
martin

i am not good at VBA.

currently my code shown in my OP. has an error. i do not know what it occurs and how to fix it.
0
Martin LissOlder than dirtCommented:
Please take a look at my article on debugging. If you have any questions about it please let me know.
0
Fabrice LambertFabrice LambertCommented:
Well, after some testing, it appear that the DocumentComplete event can' help as there are some javascript running once the document is loaded.

So, we have 3 solutions:
1) Export manually the result to excel (there is a link on the page for that), and import it into your application.
2) Contact United Nations, and ask them if they have any API or web services to automatically retrieve the datas.
3) Do the dirty way: Add a loop in your code, doing Nothing for like 5 or 10 seconds.
Insert the following after the loop waiting for the document to be loaded (WARNING: No garantees that it will always work !!!):
'// wait an additional 5 seconds
Dim dt As Date

dt = Now
While (DateDiff("s", dt, Now) < 5)
    DoEvents
Wend

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FloraAuthor Commented:
thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.