Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save as - provide filename but user picks location

Status
Not open for further replies.

Thwarted

Technical User
Oct 10, 2002
32
CA
Hi

I have searched Save As and do not see this question though I am sure it had to have been asked and answered so I am sorry for the repeat if it does exist.

I need to code my Excel sheet to Save As where i provide a filename based on contents of a cell - but I allow them to choose the path.

Sorry for this very basic question - I am sure it is easy as pie I just dont know how to do it.

Sub SaveAsExample()

Dim FName As String
Dim FPath As String

FPath = ""
FName = Sheets("Sheet1").Range("A1").Text
ThisWorkbook.SaveAs Filename:=FPath & "\" & FName


End Sub

The code above just saves to default path

Thanks in advance for your help.

 
FPath = application.filedialog(msoFileDialogFolderPicker).SelectedItems (1)
 


Hi,

Check out the GetSaveAsFileName method in VBA Help.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks guys!

The GetSaveAsFileName method worked great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top