Save As "Cell A1"

  • Thread starter Thread starter gtton
  • Start date Start date
G

gtton

Hi, how do I get the "File Name" window in the "Save As" dialog to sho
the word entered in cell A1?

Thanks, Glory

sub saveas ()
Application.Dialogs(xlDialogSaveAs).Show
end su
 
Got this by recording a macro in Excel 2000

ChDir "C:\WUTemp"
ActiveWorkbook.SaveAs Filename:="C:\WUTemp\Test.xls",
FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False


dim wbn as string
wbn = Sheets("MySheet").Range("A1").Text

ChDir "C:\WUTemp"
ActiveWorkbook.SaveAs Filename:="C:\WUTemp\" & wbn, FileFormat:=xlNormal
_
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False


You can also add a variable for DhDir
dim dir as string
dir = "C:\MyFolder\"
ActiveWorkbook.SaveAs Filename:=dir & wbn
 
You could just pass it that parm:

Option Explicit
Sub MySaveAs()
Application.Dialogs(xlDialogSaveAs).Show _
ThisWorkbook.Worksheets("Sheet1").Range("a1").Value
End Sub

I changed the name of your subroutine, too. SaveAs is used by excel. It may
not confuse excel, but it surely would confuse me.
 
Back
Top