Display a SaveAs File Dialog Box

by Linda Quinn

Close Window
This code allows the user to select the name of the file being saved.
It also allows the user to select the path where the file will be saved.


Dim filex As Variant

filex = Application.GetSaveAsFileName
      (FileFilter:="microsoft excel files (*.xls), *.xls", _
if filex <> false then
MsgBox "File Saved as " filex
End If



Examples of Filter Statements
FileFilter:="Microsoft Excel Files (*.xls), *.xls"
FileFilter:="Text Files (*.txt), *.txt"
FileFilter:="Add-In Files(*.xla), *.xla"
FileFilter:="Text Files (*.txt), *.txt", Add-In Files(*.xla), *.xla"
The above will list both filters in the drop-down box
FileFilter:="Visual Basic Files(*.bas; *.txt), *.bas; *.txt"
Semi-colons separate multiple file types for a single filter type



=================================================================
This content was created by Linda Quinn of LQNet.

See http://www.lqnet.com for a great collection of articles on this and other topics.

=================================================================
Copyright © 2006-2008, LQ Systems,Inc. All rights reserved.


====================================================================
Want an expert to help with your project?    LQ Systems, Inc.   Business Solutions
====================================================================