Saving a workbook

A

Andrew B

Hi
I am trying to save a newly created workbook, using the value of a cell
as its name.
These cell values are used in the first workbook.

[M24] = C:\Documents and Settings\Memos\ 'Pathway for file
[M19] = Memo1 'file name

Workbooks.Add

Then, I've tried the following without success:

Workbook.SaveAs ([M19] & ".xls")
or
ActiveWorkbook.SaveAs [M19] & ".xls"
or
ActiveWorkbook.SaveAs [M24] & [M19] & ".xls"
or
Workbooks(ActiveWorkbook).SaveAs [M19] & ".xls"

Can someone please help me ?

Thank you
 
D

davesexcel

myfilename = "d:\somewhere\" & Range("customer") & "\"
Range("address")
ActiveWorkbook.SaveAs Filename:= _
myfilename, FileFormat _
:=xlNormal, Password:="", _
WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False

"customer" is a named range for a subdirectory
for this to work, the subfolder already has to exist

"address" is a named range for the actual file name

you don't have to used named ranges, but I like to, because its easie
to write formulas and work with code
 

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