The Save As dialog cannot be automated using VBScript in WSH.
There are at least three problems with this dialog when using ExecWB.
1. The dialog will always be visible and require intervention of the user:
OLECMDEXECOPT_DONTPROMPTUSER is broken and does nothing.
2. The path to the file is in all circumstances ignored. You may as well
use NULL.
3. There is no way to change the file type to be saved. The only input
parameter is supposed to be for the file name and path, which as I said is
completely broken. The only way to get a dialog with all applicable file
types present is by using OLECMDEXECOPT_DONTPROMPTUSER.
Here is my code.
Sub MHT_Save()
'TODO: Remove hard-coded file path
'OLECMDID_SAVEAS = 4 (from MSDN "OLECMDID" topic)
'Also OLECMDEXECOPT_DONTPROMPTUSER = 2
'Save the file using InternetExplorer.Application ExecWB method
App.ExecWB _
OLECMDID_SAVEAS, _
OLECMDEXECOPT_DODEFAULT, _
"C:\\Documents and Settings\\quell\\Desktop\\MHT Project\\MHT File
Output", _
NULL
WScript.Echo("Saving file...")
WScript.Echo(Now())
Do While App.ReadyState <> READYSTATE_COMPLETE
WScript.sleep(1000)
Loop
state = SAVED
End Sub