ShowSaveFileDialog method (WinStudio scripts)
Applies To
IWSApplication interface
Definition
Opens a standard Windows Save File dialog box, optionally passing the path and name of a file to save; and returns the path and file name the user sets.
Syntax
Application.ShowSaveFileDialog( string1, string2, string3, [ string4, string5 ] )
Part | Description |
string1 | Required. By reference, the path and name of the file to be saved. |
string2 | Required. The text that appears in the title bar of the Save File dialog box. |
string3 | Required. A
string containing a pipe-delimited list of file extension filters. These
filters control what is displayed in the file selection field.
These filters must each use the format: fileType|*.ext where:
Example: The following example causes the Files of type drop-down list in the Save File dialog box to include options for JPG, PNG, and All files. "JPG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|All files (*.*)|*.*" To specify no filters, use an empty string (""). |
string4 | Optional. The
extension that the system should add as the default extension to a file name if
no other extension is specified.
For example, suppose you specify "txt" for this string. If a user then specifies MyFile as the file name (with no extension) then the system automatically appends a dot ( . ) and this default extension. In this case, the system returns the file name as MyFile.txt. If the user does specify an extension, (for example, MyFile.doc or MyFile.txt), then the system appends nothing to the file name. To specify no default extension, use an empty string ("") for this. In this case, the system adds no extension if the user does not specify one. If you use this parameter, you must also use string5, and vice versa. |
string5 | Optional. The
full path to the default folder to open when the
Save File dialog box opens.
Example: C:\Temp\Graphics If the specified folder does not exist, the system defaults to whatever the "current" folder is. To specify no default path, use an empty string ("") for this. If you use this parameter, you must also use string4, and vice versa. |
Remarks
The return is a string containing the path and file name under which the user saved the file.
Example
Public Sub SaveFileDialog() Dim FileName As String FileName = String.Empty Application.ShowSaveFileDialog(FileName, "Save File", _ "JPG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|All files (*.*)|*.*", _ "", "C:\WINDOWS\Web\Wallpaper") Application.ShowMessage("Test value = " & FileName) End Sub