Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Automating the IE6 Save As Dialog

Posted on 2007-10-16
1
Medium Priority
?
1,696 Views
Last Modified: 2013-11-27
Dear VBA expert.  I have successfully opened a browser and executed a javascript function which opens a Save As dialog box with the code below.  NOW I would like to be able to automate the Save As dialog box by controlling it's directory path and name... or at the very least being able to automate it so it can save to the default path automatically.

Below is my code.  Thanks so much!

Dim oIE As Object
    Set oIE = CreateObject("internetexplorer.application")
    sUrl = "MY URL"
    oIE.Navigate2 sUrl
    oIE.Visible = True

    Do While oIE.Busy
        VBA.DoEvents
    Loop
    Do While oIE.ReadyState <> 4
        VBA.DoEvents
    Loop
   
    Call oIE.Document.parentWindow.execScript("runthefex1('2')", "JavaScript")
   
    Do While oIE.Busy
        VBA.DoEvents
    Loop
    Do While oIE.ReadyState <> 4
        VBA.DoEvents
    Loop
   
   'AUTOMATE The SAVING PROCEDURE O THE IE6 SAVE as dialog box.
0
Comment
Question by:cations
1 Comment
 
LVL 31

Accepted Solution

by:
Frosty555 earned 1500 total points
ID: 20095679
You can use ExecWB() method passing IDM_SAVEAS as the command, to perform the File->Save As in Internet Explorer. However it will prompt for a location. There is no way to suppress the prompt. You can however use the URLDownloadToFile() API call to save the web page without prompting and this might prove sufficient for you:

http://support.microsoft.com/kb/244757/EN-US/


If you only need the HTML of the page you are on, check out this example. It describes how to use VB to save the HTML of a page using a WebBrowser control:

http://support.microsoft.com/kb/292485
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
When we develop an application in Ms Access 2016 we should also try to protect the queries, macros and table links. I know I may not have a permanent solution but for novice users, they will not manage to break your application. Below is the detail …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question