All Forums >> [Scripting] >> WSH & Client Side VBScript >> Open Save Digaloge box in VB Script Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Posts: 39
Score: 0
Joined: 5/11/2005
From: India
Status: offline
Can anyone provide me the scipt for to open save Dialogue box in VB script. By Save Dialoguebox I mean if u want to save file you just go to the file and click on the option called Save As and one pop window or dialogue box will come where you can give the name of the file and save it where ever u want. I want to open the same dialogue box by clicking the button "Save"
my script is like below <html> <body> <input type="Button" value="Save" and name ="Save"> </input> </body> </html>
The "FileType" property of the FileSave dialog object is for displaying purposes only. It hasn't got any effect on the saving of the file. To save a file as an XML file, you only have to make sure the value of the "FileName" property has got the correct extension.
Posts: 39
Score: 0
Joined: 5/11/2005
From: India
Status: offline
Zifter, for to save the xml file i am writing the follwoing script but than after it doesn't save anyhting in the file. Would you please tell me if there is something wrong in my script code ??
Set objDialog = CreateObject("SAFRCFileDlg.FileSave") objDialog.FileName = "C:\Newtemplate.xml" objDialog.FileType = "XML Document xml" intReturn = objDialog.OpenFileSaveDlg If intReturn Then Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.CreateTextFile(objDialog.FileName) objFile.WriteLine Date objFile.Close End If
Nothing wrong with the syntax of that script. It will create a file on the C-drive with the name "Newtemplate" and because it has the extension "xml" it will be recognised as a XML file. Then the current date will be written to this file. This works, I tested it. Although nothing is wrong with this syntax, you are creating a XML file with only a date written to it. This is not a valid XML file. Consider this example: HTH