Automate saving a webpage

I have a visual basic app that is supposed to open a webpage, open a webpage and automatically save it to a local directory.

The problem is that when i initiate the save webpage command, it still opens the dialog box as to where to save the webpage.

Here is the code that I use to start the save.

WebBrowser1.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER, FileName + "CaseID " + CsrList(i) + ".htm"

What is the point of dontpromptuser if a dialog box still shows up?

Secondly, how do i get around this problem?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


- Joe
SAVE/SAVEAS act as the options from the "File" menu do. You can only use SAVE if you've previously saved.

"How To Download a File Without Prompting"

The WebBrowser control and Internet Explorer have Save and Save As options that can be used to save files using the ExecWB command. However, this involves prompting from the user. There is no way to suppress this prompt. To save files to the hard-disk without prompting, use the URLDownloadToFile API from URLMON.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I just posted how to do this in a different topic but I am sure this is what you need.

you can always just use the Microsoft Internet Trasnfer Control it should do what you want here is a example of how to download a file

Global myVer As String
Global status$
Global UpdateTime As Integer

Public Function GetInternetFile(Inet1 As Inet, myURL As String, file As String) As Boolean
    ' Written by: Blake Pell
    On Local Error GoTo 100
    Dim myData() As Byte
    Dim str As String
    Dim x As Long
    If Inet1.StillExecuting = True Then Exit Function
    myData() = Inet1.OpenURL(myURL, icByteArray)

    myFile$ = App.Path & "/" & file
    Open myFile$ For Binary Access Write As #1
    Put #1, , myData()
    Close #1
    GetInternetFile = True
    Exit Function

' error handler
GetInternetFile = False
    Resume 105
105 End Function

then just call the function like so

GetInternetFile frmMain.Inet1, "","filenametosaveto.ext"
TriggerHappyAuthor Commented:
Wow...that was perfect...

Sorry for the long wait, but had other work to finish before i could test this solution.
Am I missing something here...what does the inet1 argument mean?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.