Try something like the following:
Sub AAA()
Dim FolderName As String
Dim FileName As String
Dim FullName As String
FolderName = "C:\Test\" '<<< CHANGE
FileName = Worksheets("Sheet1").Range("A1").Text '<< CHANGE
If InStr(1, FileName, ".xls") = 0 Then
' add the XLS extension if it is not present
FileName = FileName & ".xls"
End If
If StrComp(Right(FolderName, 1), "\", vbBinaryCompare) <> 0 Then
' add trailing slash to folder if not present.
FolderName = FolderName & "\"
End If
FullName = FolderName & FileName
ThisWorkbook.SaveAs FullName
End Sub
Change the lines marked with <<< CHANGE to the appropriate values. The
code will save the workbook using the name in cell A1 in the folder
"C:\Test". If the filename in A1 does not end in ".xls", that will be
appended to the file name.
If you have the folder in which the file should be saved in some cell,
change
FolderName = "C:\Test\"
' to something like
FolderName = Worksheets("Sheet1").Range("C1").Text
If you want to prompt the user to select a folder, download the
modBrowseFolder.bas module at
http://www.cpearson.com/Excel/BrowseFolder.aspx . Then, do something
like
FolderName = BrowseFolder()
If FolderName = vbNullString Then
' user cancelled. get out.
Exit Sub
End If
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)