Save As Part 2

E

el zorro

I received this macro from one of the members of the community yesterday. It
saves the file with a filename from cell A1. It also saves it on a specific
directory.

Sub Save_As()
Dim s As String
s = "C:\Documents and Settings\user\My Documents\" & Range("A1").Value &
".xls"
ActiveWorkbook.SaveAs Filename:=s
End Sub

I would like to have an updated macro whereby the destination directory
would be the user's choice, maybe show the "Save As" window and let them
choose and navigate from that window to the folder of their choice. The
filename should still come from cell A1 of the file.

Is this possible? Please help. Thanks.
 
J

Jim Thomlinson

Give this a whirl...

Sub Save_As()
Dim objShell As Object
Dim objFolder As Object
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(&H5&)
Application.Dialogs(xlDialogSaveAs).Show _
objFolder.Self.Path & "\" & Range("A1").Value & ".xls"
End Sub
 
E

el zorro

Jim,

Worked great. Thank you very much.

Jim Thomlinson said:
Give this a whirl...

Sub Save_As()
Dim objShell As Object
Dim objFolder As Object
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(&H5&)
Application.Dialogs(xlDialogSaveAs).Show _
objFolder.Self.Path & "\" & Range("A1").Value & ".xls"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top