Automate save and close

Y

y_not

I need my workbook to save the changes and rename the file (to the nam
in cell A1) when I close the workbook ... is it possible to automat
this?

I use the workbook for invoice generation, cell A1 is the unique numbe
and I have a clerk who keeps overwriting the previous file by simpl
answering "Yes" to the prompt "Do you want to save the changes" withou
renaming the file.

Many thanks for your help

Ton
 
D

dalipsinghbisht

You should make a master file for your data and always use Save As n
Save. Or you can Save the data to press the key F12 and give a new nam
to that file. Hope this will help you.

Dali
 
P

protonLeah

One possibility is to use an auto start macro such as:

Option Explicit
Private Sub workbook_open()
Dim fname As String

fname = Sheets("sheet1").Range("a1").Value

ActiveWorkbook.SaveAs _
Filename:=fname, _
FileFormat:=xlWorkbook, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub

This will save the file with the whatever name is in cell A1 every tim
it is opened.

Be
 

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