+ Reply to Thread
Results 1 to 4 of 4

Accessing web controls using IE

  1. #1
    Registered User
    Join Date
    05-20-2009
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    57

    Accessing web controls using IE

    I am looking into auto filling out forms consisting of textboxes and checkboxes using IE. The problem that I am running into is when I come across a webpage with frames and I am unable to view the html source code. Can you please point me in the right direction? Thanks!

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

    Re: Accessing web controls using IE

    Hello bigmack,

    Each frame is a window that contains a WebBrowser object. For security, you can only control the WebBrowser object, if you are hosting it. Both VB and VBA are denied access to other objects in any frame other than the main window. Accessing the Document of a Frame will only return the HEAD, BODY, and HTML tags. You need to use another language like VC++ or Java to access the contents of the frames.
    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!)

  3. #3
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Accessing web controls using IE

    I'm not sure why you can't view the HTML source, as both IE and Firefox can display the HTML source of a frame, but only Firefox, it seems, can display the HTML source of the frameset.

    You could access the form elements using the HTML Object Library in VBA. The frameset is a HTMLDocument object and each frame is a IHTMLWindow object. HTMLDocument.frames is the collection of frames.

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

    Re: Accessing web controls using IE

    Hello Chippy,

    It won't work for the reason I stated above. VBA can not access other objects in any frame other than the main window. Only the server side application can return the HTML code from a frame.

+ 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