Results 1 to 4 of 4

VBA Internet Explorer Automation using frames

Threaded View

  1. #1
    Registered User
    Join Date
    02-01-2011
    Location
    Philadelphia, Pennsylvania
    MS-Off Ver
    Excel 2007
    Posts
    57

    VBA Internet Explorer Automation using frames

    i've tried this for awhile now and feel as though im close just missing something. the website i'm trying to enter data into is an electronic document system and is based on a server here at work so i wont be able to send anyone a link as you wouldnt be able to access it. however i have gone through the html to find certain pieces of info i need. the site is split into 10+ frames (i believe) the frame im looking to reference is labeled "frameSearchCriteria" (both name & id) (also form name is "xForm" if thats relevant) the field i'm trying to have data input in to is "xObjectSearchId" (name). this is what i have so far, not sure how to identify the specific frame, and form if necessary. please help!

    Sub Xdoc()
       
    
        Dim oIE As InternetExplorer
        Dim HTMLDoc As HTMLDocument
        Dim frmCol As FramesCollection
        Dim htmlColl As Object
        Dim htmlInput As Object
        
        
        Set oIE = CreateObject("InternetExplorer.Application")
        oIE.Navigate ("http://imaging/xsuite/xapps/default.aspx")
        
        Do While oIE.Busy: DoEvents: Loop
        Do While oIE.readyState <> 4: DoEvents: Loop
        
        oIE.Visible = True
    
         ' Go through <frame> to get to main document
        Set frmCol = oIE.document.frames 'Get the frame collection
        Set HTMLDoc = frmCol.Item(1).document 'Get the HTML document within the frame
        Set htmlColl = HTMLDoc.getElementsByName("xObjectSearchId") 'Get the input collection from this HTML doc
        For Each htmlInput In htmlColl
            If htmlInput.Name = "xObjectSearchId" Then htmlInput.Value = ("4212080657")
        Next htmlInput
        
        Set oIE = Nothing
    
    End Sub

    Moderator's Note: Welcome to the forum, You have to put code tags around code. Select the codes then hit the "#"
    Last edited by vlady; 11-14-2012 at 09:00 PM. Reason: code tags

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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