+ Reply to Thread
Results 1 to 7 of 7

IE.document.getElementByID returns run-time error '91'

  1. #1
    Registered User
    Join Date
    02-25-2013
    Location
    Tampa
    MS-Off Ver
    Office 2007 . 2010
    Posts
    4

    IE.document.getElementByID returns run-time error '91'

    Hello,
    I have a VBA module that opens IE and tries to enter a user name into the text box. I have references to the MS HTML object library and the MS internet controls library.


    The code works fine with this page... https://patriotweb.gmu.edu/pls/prod/twbkwbis.P_WWWLogin (the input box is: user name here)

    But for this page it returns an error ... http://www.ncsu.edu/grad/applygrad.htm (the input box here is pin)

    I know that there must be some difference in the structure of the two pages that is causing this problem, but I haven't been able to come up with a workaround.

    Here is the code I have been trying... Any explanation or recommendations would be greatly appreciated!!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IE.document.getElementByID returns run-time error '91'

    The form with the PIN input is in a frame called 'Application'.

    If you goto View>Source all you'll see is this:

    HTML Code: 
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-25-2013
    Location
    Tampa
    MS-Off Ver
    Office 2007 . 2010
    Posts
    4

    Re: IE.document.getElementByID returns run-time error '91'

    Thanks for the quick response! How can I reference the form within the certain frame?

  4. #4
    Registered User
    Join Date
    02-25-2013
    Location
    Tampa
    MS-Off Ver
    Office 2007 . 2010
    Posts
    4

    Re: IE.document.getElementByID returns run-time error '91'

    So I tried the following...

    Please Login or Register  to view this content.

    But that gave me a Run-time error '-2147024891 (80070005)':
    Access is denied


    Any idea if this is simply a security feature or am I completely off target with the code?

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IE.document.getElementByID returns run-time error '91'

    Quite similar to what I tried, but I used a few extra steps.

    Same 'Access denied' problem though.
    Please Login or Register  to view this content.
    What version of IE are you using?

  6. #6
    Registered User
    Join Date
    02-25-2013
    Location
    Tampa
    MS-Off Ver
    Office 2007 . 2010
    Posts
    4

    Re: IE.document.getElementByID returns run-time error '91'

    IE8.. From what I've read its a security feature to prevent "cross frame scripting" from taking place

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IE.document.getElementByID returns run-time error '91'

    I tried this which works.

    It navigates to the URL of the frame which has the input box.
    Please Login or Register  to view this content.
    Last edited by Norie; 02-26-2013 at 03:03 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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