vba code works in ie10 but not ie11

the following code snippet works in ie10, but not with ie11.


    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_cbSelectDatapoints").Click
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_cbSelectDatapoints").Checked = True
    Do: Sleep 100: Loop While .Busy
    
    .Document.getElementById("ctl00_ContentPlaceHolder_cbAll").Click
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_cbAll").Checked = True
    Do: Sleep 100: Loop While .Busy

Open in new window


Line 7 gets and error 424 object required.

 
It is acting as if I had misspelled ctl00_ContentPlaceHolder_cbAll

I can't figure it out.

rberke

P.S. I had the identical error message elsewhere, but I solved it by changing "Tagname" instead of "TagName".  Ie10 did not care as much about lowercase and upper case.
Clearly, that is not what is causing today's problem.


I have attached a file with the snipped HTML code.
html-in-text-file.txt
LVL 5
rberkeConsultantAsked:
Who is Participating?
 
RobConnect With a Mentor Owner (Aidellio)Commented:
it's likely to do with the markup as there's errors in it and IE11 is much less forgiving

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.slforms.universalservice.org%2FDRT%2FDefault.aspx&charset=%28detect+automatically%29&doctype=Inline&group=0

I'm trying to track it down for you but it's going to be a badly closed tag etc
0
 
Dave BaldwinFixer of ProblemsCommented:
VBscript has been deprecated in IE11 and in some cases, does not work at all.
http://msdn.microsoft.com/en-us/library/ie/dn384057%28v=vs.85%29.aspx
0
 
rberkeConsultantAuthor Commented:
Luckily, I am using vba, not vbscript.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Dave BaldwinFixer of ProblemsCommented:
I don't see any of your code in the file that you posted.  Where is it running?  What program is running it?
0
 
rberkeConsultantAuthor Commented:
It is running under excel 2010 in an offce 2010 pro/ windows 7 pro environment.  

Paste the following into a vba module and run it
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub test()
Dim ieobj As Object
Set ieobj = CreateObject("InternetExplorer.Application")
With ieobj
    .Visible = True
    .navigate "http://www.slforms.universalservice.org/DRT/Default.aspx"
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_ddlFundingYear").Value = 2013
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_BEN").Value = 12345
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_cbSelectDatapoints").Click
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_cbSelectDatapoints").Checked = True
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_cbAll").Click  ' <===== here is the problem
    Do: Sleep 100: Loop While .Busy
    .Document.getElementById("ctl00_ContentPlaceHolder_cbAll").Checked = True
    Do: Sleep 100: Loop While .Busy
End With


End Sub

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
"ctl00_ContentPlaceHolder_cbAll" doesn't exist in the page until after you check the box for "ctl00_ContentPlaceHolder_cbSelectDatapoints".  Does the page work in IE11 directly?  I don't have it so I can't check.

I suggest you click on "Request Attention" above and get the Excel and VBA Topic Areas added to your question.  The Web Development Software Topic Area is more about writing server side code and HTML to generate web pages.
0
 
rberkeConsultantAuthor Commented:
Yes, the page works when manipulated manually.  By the way, you can run the code from any of the major vba apps. Excel or Word or Outlook.  I will request attention but, i have a strong feeling the problem is not with vba
0
 
Dave BaldwinFixer of ProblemsCommented:
The problem may not be with your VBA since it worked before.  But this Topic Area won't normally get attention from anyone who really knows.  I just happen to check all the zones out of curiosity to see what people are asking about.
0
 
rberkeConsultantAuthor Commented:
Ugh, it comes from a government website, so it will not be fixed for a very long time.

I guess I'll have to revert to IE10.  

What do you mean when you say you'll try "to track it down" ?  Doesn't the validation output option already do that?  Of course, lots of that output appears to be overly picky, so perhaps the website is perfect, but the validator is wrong?

In either case, I do not intend to forward the problem to the government agency. They have much bigger problems to worry about than my silly little vba program.
0
 
RobOwner (Aidellio)Commented:
Doesn't matter as it's not your website.... so its not possible at this stage. Since my laSt post I was able to get it working with a copy of the site on my own domain with the offending elements removed. ... Can't get that time back can I!? :)
0
 
Dave BaldwinFixer of ProblemsCommented:
I don't see it as being overly picky.  We see a lot of invalid HTML code here.  Sometimes all it takes to break a page is to leave off a closing tag, especially on a comment.  Doing that make the rest of the page part of that comment.

And "overly picky" is a human viewpoint.  When rendering web pages, computers go by the rules and have no sense of being picky though browsers are written to try to show a page as best they can.  They still don't "know what you meant".

The rules that the browser is supposed to use are defined by the DOCTYPE at the top of the page.  And one of the things that happens fairly often is people think they are 'upgrading' their page by putting a newer DOCTYPE at the top of the page and never checking to see if their page is using the rules for that DOCTYPE.  Running your page thru the Validator is the easiest and quickest way to do that.
0
 
rberkeConsultantAuthor Commented:
Murphy's law strikes again.  I reverted to IE10.  The error message goes away, but the program still doesn't work  !!!!

I'll bet 10 to 1 that the SLD (the government sponsored company) has broken the web site recently.  This is a fairly big problem for me, but I will survive.

Since you have done the work to fix it, please attach  your revised version and  I will forward it to  them. They may actually fix it.  

If you have already deleted it, don't worry about it.
0
 
Dave BaldwinFixer of ProblemsCommented:
I'll bet they say they "fixed" it...
0
 
RobOwner (Aidellio)Commented:
*laughs* , exactly Dave!

As for the validated html - I fixed the errors that were in the validator as well as tried opening it in xmlnotepad and fixed the errors it gave me.  Nothing special but it did the job.
0
 
RobOwner (Aidellio)Commented:
This is the html file that worked for me.  also attached the xlsm for you to view.  I was using my own site as you'll see in the link.
index.html
Book1.xlsm
0
 
rberkeConsultantAuthor Commented:
Great work and MUCH appreciated.

I'll send it to the government agency. They give every request a tracking number, so it won't get "lost". It may even get fixed as this particular web page is very heavily used by thousands of users.

Thanks again
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.