Save As "Cell A1"

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
 
S

STEVE BELL

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
 
D

Dave Peterson

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.
 

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

Similar Threads


Top