+ Reply to Thread
Results 1 to 5 of 5

Internet Explorer Macro Automation

Hybrid View

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

    Internet Explorer Macro Automation

    Hi All,
    I’m trying to figure out how to have a macro bring up this website (an internal document website) reference the first frame (red) (frameSearchCriteria) uncheck the “My Loans Only” box (“xMyContainers”), Enter in a Loan Number (“xObjectSearchValue”) and click search (id=”xSearchSubmit”), then jump to the second frame (blue) (“frameSearchResults”) and click that row that starts with the loan number (“xRowClickAction”) which opens another window. i’ve started most of it, but it doesn’t seem to be doing anything. I'm curious if referencing specific frame names or forms would help and it also looks like the "Loan Number" field has multiple names to it, not sure if that has something to do with it. i've tried attaching the html and a snip of the website however the attachments dont seem to be working. i will keeping attempting to post those. as always the help is greatly appreciated!

    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("xMyContainers") 'Get the input collection from this HTML doc
        For Each htmlInput In htmlColl
            If htmlInput.Name = "xMyContainers" Then htmlInput.Value = ("0")
        Next htmlInput
        Set htmlColl = HTMLDoc.getElementsByName("xObjectSearchValue") 'Get the input collection from this HTML doc
        For Each htmlInput In htmlColl
            If htmlInput.Name = "xObjectSearchValue" Then htmlInput.Value = ("4213010634")
        Next htmlInput
        Set htmlColl = HTMLDoc.getElementsByName("Search") 'Get the input collection from this HTML doc
        For Each htmlInput In htmlColl
            If htmlInput.Name = "Search" Then htmlInput.Click
        Next htmlInput
            
         Do While oIE.Busy: DoEvents: Loop
        Do While oIE.readyState <> 4: DoEvents: Loop
    
    
        Set oIE = Nothing
    
    End Sub
    See Attached for HTML and screen snip, sorry if the highlighting on the screen shot is a bit messy.
    Attached Files Attached Files
    Last edited by JBeaucaire; 03-14-2013 at 07:33 PM.

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

    Re: Internet Explorer Macro Automation

    just noticed there's an iframe. here's what its updated to. anyone have any ideas?

    Public Sub IE_Automation()
    
        Dim baseURL As String
        Dim IE As InternetExplorer
        Dim HTMLDoc As HTMLDocument
        Dim mainFrame As HTMLIFrame
        Dim slotsDiv As HTMLDivElement
        Dim frmCol As FramesCollection
        Dim htmlColl As Object
        Dim htmlInput As Object
        
        baseURL = "http://imaging/xsuite/xapps/default.aspx"
        
        Set IE = New InternetExplorer
        With IE
            .Visible = True
            
            'Navigate to the main page
            
            .Navigate baseURL & "axSearchCriteria.aspx?xProjectId=1000&SearchResultsFrame=frameSearchResults&xRowClickAction=fnLaunchViewer(this)"
            While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
           
            'Get the mainFrame iframe and navigate to it
        
            Set mainFrame = .document.getElementById("frameSearchCriteria")
            .Navigate baseURL & mainFrame.src
            While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
            
        Set frmCol = IE.document.frames 'Get the frame collection
        Set HTMLDoc = frmCol.Item(1).document 'Get the HTML document within the frame
        Set htmlColl = HTMLDoc.getElementsByName("xMyContainers") 'Get the input collection from this HTML doc
        For Each htmlInput In htmlColl
            If htmlInput.Name = "xMyContainers" Then htmlInput.Value = ("0")
        Next htmlInput
        Set htmlColl = HTMLDoc.getElementsByName("xObjectSearchValue") 'Get the input collection from this HTML doc
        For Each htmlInput In htmlColl
            If htmlInput.Name = "xObjectSearchValue" Then htmlInput.Value = ("4213010634")
        Next htmlInput
        
        Do While IE.Busy: DoEvents: Loop
        Do While IE.readyState <> 4: DoEvents: Loop
    
    
        Set IE = Nothing
        End With
        
        
    End Sub

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

    Re: Internet Explorer Macro Automation

    bump, anyone?

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

    Re: Internet Explorer Macro Automation

    Post responsibly. Search for excelforum.com

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Internet Explorer Macro Automation

    Thanks Chippy.

    kboy,

    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

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