ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto Save on closing (https://www.excelbanter.com/excel-discussion-misc-queries/46032-auto-save-closing.html)

AJM1949

Auto Save on closing
 
I would like to auto save an excel workbook using a cell value as the file
name and save it in a specific folder ie My Documents\Quotes. I have been
unable to find an answer to this in previous responses. Any help would be
very much appreciated.

Thanks in advance
--
AJM1949

Bob Phillips

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SaveAs Filename:=Worksheets("Sheet1").Range("A1").Value
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"AJM1949" wrote in message
...
I would like to auto save an excel workbook using a cell value as the file
name and save it in a specific folder ie My Documents\Quotes. I have been
unable to find an answer to this in previous responses. Any help would be
very much appreciated.

Thanks in advance
--
AJM1949




AJM1949

Hello Bob
Many thanks for the code. How can I specify the path to save the workbook
to-in this instance I want it to be My Documents\Quotes.
--
AJM1949


"Bob Phillips" wrote:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SaveAs Filename:=Worksheets("Sheet1").Range("A1").Value
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"AJM1949" wrote in message
...
I would like to auto save an excel workbook using a cell value as the file
name and save it in a specific folder ie My Documents\Quotes. I have been
unable to find an answer to this in previous responses. Any help would be
very much appreciated.

Thanks in advance
--
AJM1949





Bob Phillips

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SaveAs Filename:= "C:\My Doc umtnets\Quotes\" & _
Worksheets("Sheet1").Range("A1").Value
End Sub

--
HTH

Bob Phillips

"AJM1949" wrote in message
...
Hello Bob
Many thanks for the code. How can I specify the path to save the workbook
to-in this instance I want it to be My Documents\Quotes.
--
AJM1949


"Bob Phillips" wrote:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SaveAs Filename:=Worksheets("Sheet1").Range("A1").Value
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"AJM1949" wrote in message
...
I would like to auto save an excel workbook using a cell value as the

file
name and save it in a specific folder ie My Documents\Quotes. I have

been
unable to find an answer to this in previous responses. Any help would

be
very much appreciated.

Thanks in advance
--
AJM1949








All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com