Results 1 to 2 of 2

VBA to click the "Open" or "Save" button in Internet Explorer Dialogue Box

Threaded View

  1. #1
    Registered User
    Join Date
    01-08-2019
    Location
    Philippines
    MS-Off Ver
    Microsoft Office 2016
    Posts
    2

    VBA to click the "Open" or "Save" button in Internet Explorer Dialogue Box

    Hi Everyone,

    Please help me on this problem I had. This issue made me stuck in proceeding and I'm afraid that it will lead me to nothing. I've already created a script that will automatically navigate the page and extracting the file. But the dialogue box in IE made me stuck. Please help me to have code that can click the "Open" or "Save" button in the dialogue box. This dialogue box is not part of the webpage anymore. Below is my current code. Please help. I need your brilliant mind.


    Thank you

    
    Sub extract()
    
    Dim IE As New SHDocVw.InternetExplorer
    Set IE = New InternetExplorerMedium
    Dim HTMLDoc1 As HTMLDocument
    Dim HTMLDoc2 As HTMLDocument
    Dim frame1 As HTMLFrameElement
    Dim frame2 As HTMLFrameElement
    Dim HTMLButton1 As HTMLButtonElement
    Dim HTMLButton2 As HTMLButtonElement
    Dim HTMLButton3 As HTMLButtonElement
    Dim HTMLTextBox1 As HTMLInputTextElement
    
    
    IE.Visible = True
    
    'This is the link to navigate the page
    IE.navigate "URL HERE"
    
    
    Do While IE.readyState <> READYSTATE_COMPLETE
    Loop
    
    'This will click the Variable Screen Button
    Application.Wait (Now + TimeValue("0:00:05")) 'Wait for 5 seconds to make the page fully loaded
    Set HTMLDoc1 = IE.document
    Set frame1 = HTMLDoc1.getElementsByName("iframe_Roundtrip_9223372036563636042")(0)
    Set HTMLDoc1 = frame1.contentDocument
    Set HTMLButton1 = HTMLDoc1.getElementById("BUTTON_OPEN_SAVE_btn3_acButton")
    HTMLButton1.Click
    
    'This will click the button OK in the pop up window
    Application.Wait (Now + TimeValue("0:00:05")) 'Wait for 5 seconds to make the page fully loaded
    Set HTMLDoc2 = IE.document
    Set frame2 = HTMLDoc2.getElementsByName("urPopupOuter0")(0)
    Set HTMLDoc2 = frame2.contentDocument
    Set HTMLButton2 = HTMLDoc2.getElementById("BUTTON_0")
    HTMLButton2.Click
    
    
    'This will click the Export to Microsoft Excel Button
    Application.Wait (Now + TimeValue("0:00:05")) 'Wait for 5 seconds to make the page fully loaded
    Set HTMLDoc1 = IE.document
    Set frame1 = HTMLDoc1.getElementsByName("iframe_Roundtrip_9223372036563636042")(0)
    Set HTMLDoc1 = frame1.contentDocument
    Set HTMLButton3 = HTMLDoc1.getElementById("BUTTON_TOOLBAR_2_btn3_acButton")
    HTMLButton3.Click
    
    
    'CODE to click the "open" or "save" button for DIALOG BOX.
    
    
    End Sub
    Attached Images Attached Images
    Last edited by kimvyp; 01-10-2019 at 10:58 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Open Internet Explorer as "InPrivate"
    By thewayoulike in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2015, 02:05 PM
  2. Replies: 4
    Last Post: 04-05-2014, 08:53 AM
  3. macro to open click "Save as" in intrnet explorer pop up
    By crobledo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2013, 11:06 AM
  4. VBA - IE - click on "Open" in an internet explorer "file download" window
    By victoire in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2013, 07:08 AM
  5. Open Internet Explorer as "InPrivate"
    By cerothen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2011, 04:02 PM
  6. Open "Save As" dialogue with "xls" as the default
    By whatsthatbeeping in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 01-18-2011, 11:19 AM
  7. Replies: 0
    Last Post: 01-04-2006, 06:55 PM

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