Saving Excel Docs as a 'Variable' Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to save an excel document, by a macro, that names it by a cell
within the document?

Also, is there a way, again using a macro, to open up specific files based
on cells within the document?
 
Maybe you can try this as the last line in vb.

ActiveWorkbook.SaveAs FileName:=Range("XX")

And the XX is the cel with the name of the new filename
(sorry for the bad English
 
this snippet was provided by frank kabel in a post yesterday:

with activesheet.range("A1")
activeworkbook.saveas filename:= "C:\temp\" & .value & ".xls"
end with

paste this as:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheet1.Range("A1")
ActiveWorkbook.SaveAs Filename:="e:\" & .Value & ".xls"
End With
End Sub

this will go into the 'ThisWorkbook' code module. with this code, yo
do not need to click on the save button on the toolbar to save th
file. when you close the file, it will automatically save the file wit
the value in cell A1 of Sheet1
 
i am sorry, do not use the code provided in the second half of the pos
(the one for beforeclose event). i had not properly tested the change
that i had made to it. it is giving me some errors.

just use the first part, where in i had provided frank's 3 lines o
code. that seems to be working fine
 
Back
Top