Saving a workbook with a variable name

  • Thread starter Thread starter mwc0914
  • Start date Start date
M

mwc0914

I am trying to save a workbook in the same directory as the workbook
am working from. Also, I may exceute this macro several times while m
workbook is open, so I need to figure a way to vary the "Book1" valu
each time the macro is executed. What I so far...


Workbooks.Add
Windows("tourney.xls").Activate
Range("A1:C3").Select
Selection.Copy
Windows("Book1").Activate
Range("A1").Select
ActiveSheet.Paste
Range("A5").Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=Range("c1"), _
FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

This is saving the new workbook in the "My Documents" directory. Ho
can I get it to save in the same directory as where the workbook I a
working from is contained? Also how can I vary the "Book1" value so i
I execute this macro several times while my workbook is open, I'll b
able to find the latest Book so it will be named correctly
 
Can I build a path name using the CurDir command and concatinating tha
with the value in the cell that represents the file name I want to sav
the workbook as? Then assign that full path name to a variable an
reference the variable in the Filename parameter
 

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

Back
Top