+ Reply to Thread
Results 1 to 7 of 7

getElementById run-time 13 type mismatch error

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    getElementById run-time 13 type mismatch error

    Hi everyone,

    I have the following simple code that works well on my computer (Windows 7, Excel 2013, IE11) but not on my friend's computer (Windows 7, Excel 2010, IE11). The code errors on the getElementById line. Whenever "getElementById" appears anywhere in the full code, we get a run-time error 13 (type mismatch) on his computer. I've tested getElementsByClassName in the same position and it works fine. It seems like a strange, simple error but haven't found anyone on the forums who's come across this before. Can anyone generate this error? Microsoft HTML Object Library and Microsoft Internet Controls are references. Any help would be appreciated.

    Cheers, Rob

    Please Login or Register  to view this content.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: getElementById run-time 13 type mismatch error

    try another quicker approach with..
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: getElementById run-time 13 type mismatch error

    Hello killerkoz17,

    When automating Internet Explorer, the application code runs asynchronously from the VBA code being executed. This is why you see delay loops included in the VBA code.

    To get Internet Explorer to sync up with VBA, you have to test key objects and events. The code below will do that correctly now.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: getElementById run-time 13 type mismatch error

    Thanks for the replies guys.

    Pike, thanks for the code, I'll keep that (still an XML beginner and that will help me learn). I guess I'm just trying to understand why this apparently simple code error is occurring.

    Leith, thanks for the response. I tried your code as it is written but I'm getting a run-time 424 Object required error that errors on the getElementById line. When I use your code within my full code I get run-time error 91 - Object variable or With block variable not set and an error on the same line.

    Cheers, Rob

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: getElementById run-time 13 type mismatch error

    Killer
    change false to
    Please Login or Register  to view this content.
    or add a little time delay

    Please Login or Register  to view this content.
    Last edited by pike; 12-30-2014 at 06:55 PM.

  6. #6
    Registered User
    Join Date
    02-19-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: getElementById run-time 13 type mismatch error

    Thanks for your efforts pike and Leith. pike, your addition got Leith's code working on my computer but unfortunately no effect on the full code on my friend's computer. Same run-time 13 type mismatch error

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: getElementById run-time 13 type mismatch error

    try winding the timer us a little to
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run time error type mismatch 13
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2013, 05:11 PM
  2. run-time error '13' type mismatch
    By dp1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-06-2012, 02:43 AM
  3. Run Time Error 13 Type Mismatch
    By nahge123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2012, 05:46 PM
  4. [SOLVED] Please help with Run-Time error 13 Type Mismatch
    By alec66317 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2012, 08:29 AM
  5. Run-Time error '13': Type mismatch
    By Drew Watson in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2010, 08:39 AM

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