(view source code of comdlgfs.vbs as plain text)
' A script to demonstrate the File Save dialog available in COMDLG32.OCX' Written by Rob van der Woude' http://www.robvanderwoude.comOption ExplicitDim strFilestrFile = FileSaveDialog( )
If strFile = "" Then
If Err Then
WScript.Echo "File Save failed: " & Err.Description
ElseWScript.Echo "File Save was cancelled"
End If
ElseWScript.Echo "File saved as: """ & strFile & """"
End If
Function FileSaveDialog( )
' This function displays a "Save File" dialog and returns the' fully qualified path of the entered file name or selected file Dim objDialog, wshShellConst OFN_HIDEREADONLY = &H4
Const OFN_CREATEPROMPT = &H2000
Const OFN_EXPLORER = &H80000
Const OFN_LONGNAMES = &H200000
FileSaveDialog = ""
Set wshShell = WScript.CreateObject( "Wscript.Shell" )
On Error Resume Next
Set objDialog = CreateObject( "MSComDlg.CommonDialog" )
If Err Then
MsgBox "This script requires COMDLG32.OCX." & vbCrLf & vbCrLf & "Please make sure it is installed and registered.", , "COMDLG32 not registered"
ElseobjDialog.MaxFileSize = 260
objDialog.Flags = OFN_EXPLORER Or OFN_LONGNAMES Or OFN_CREATEPROMPT Or OFN_HIDEREADONLY
objDialog.InitDir = wshShell.CurrentDirectory
objDialog.DefaultExt = "vbs"
objDialog.Filter = "VBScript files|*.vbs"
objDialog.ShowSave
FileSaveDialog = objDialog.FileName
End If
Set wshShell = Nothing
Set objDialog = Nothing
End Function
page last modified: 2025-10-11; loaded in 0.0076 seconds