Save a File Using a File Save Dialog Box

2018-09-21 18:55

阅读:666

  DemonstrationscriptthatallowsyoutoenterafilenameinaFileSavedialogbox,andthensavesasampletextfile(consistingentirelyofthecurrentdate)underthatfilename.

SupportedPlatforms

WindowsServer2003
No

WindowsXP
Yes

Windows2000
No

WindowsNT4.0
No

Windows98
No


ScriptCode

复制代码 代码如下:
SetobjDialog=CreateObject(SAFRCFileDlg.FileSave)

objDialog.FileName=C:\Scripts\Script1.vbs
objDialog.FileType=VBScriptScript
intReturn=objDialog.OpenFileSaveDlg

IfintReturnThen
SetobjFSO=CreateObject(Scripting.FileSystemObject)
SetobjFile=objFSO.CreateTextFile(objDialog.FileName)
objFile.WriteLineDate
objFile.Close
Else
Wscript.Quit
EndIf


评论


亲,登录后才可以留言!