Link to home
Start Free TrialLog in
Avatar of brettr
brettr

asked on

Accessing Save As "Web Page, complete" in IE?

Using SHDocVw or MSHTML objects in VB.NET, how can I access the File | Save As "Web Page, complete" menu item in IE?

I already have an IE window open and have loaded a  page into it.

Thanks,
Brett
Avatar of S-Twilley
S-Twilley

Im not sure about getting a webpage complete, but you can send "commands" to a browser.

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/methods/execwb.asp

and use the Save_as constant...

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/constants/saveas.asp

Let me know if you have trouble implementing this... sorry I can't post code up at the moment, in the process of fixing my installation (keep gettin an error when requesting help)
Avatar of brettr

ASKER

Thanks.  I'm getting close with this:

Me.IE_Inst.ExecWB(SHDocVw.OLECMDID.OLECMDID_SAVEAS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER)

The "web page complete" is defaulted and I have a box open waiting for me to click save.  Now I need the ability to give the file a name, path, and save programmatically.  Any suggestions?

Me.IE_Inst.ExecWB(SHDocVw.OLECMDID.OLECMDID_SAVEAS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, "C:\\Test Folder\\Some Folder\\mypage.html", Nothing)


Explanation of path (from msdn):

pvaIn VARIANT of type VT_BSTR that specifies the path and file name of the file to which to save the Web page. When the path contains more than one folder name, separate the folder names with two backward slashes (\\).
Avatar of brettr

ASKER

If I use two backslashes, the file name isn't included.  Using one backslash, it is included.  However, I'm still prompted but this time everything is prefilled.  Also, it is going to HTML save as type, rather than complete web page.  Any ideas?
I tried doing it myself and had no luck... should work according to MSDN... hmmm

Well, Im not sure how to automate that command then...  I know how to download the html file without the pictures (i.e. the html code file)... i suppose if you use the document object, you could retrieve that from the IE instance, loop through for all objects (images and activex), then download those with the html file and emulate the command. Just don't understand why the execWB  (or document.execCommand) doesn't work.

Avatar of brettr

ASKER

That feature has been disabled for security reasons: http://groups.google.de/groups?selm=L3yAKK0RCHA.2372%40cpmsftngxa07

Ok, is there any way to mimick it?  Macro...something...anything?
ASKER CERTIFIED SOLUTION
Avatar of S-Twilley
S-Twilley

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brettr

ASKER

Yahoo mail message for example.  Do you have samples of how to do the above?