ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   workbook name (https://www.excelbanter.com/excel-worksheet-functions/89291-workbook-name.html)

Tuukka

workbook name
 
Hi,
is it possible to automatically name workbooks so that it gets its name from
ie. shell A1? Workbook is saved to prevent unwanted actions but still users
would need to name each workbook.

Bob Phillips

workbook name
 
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If SaveAsUI Then
Cancel = True
ThisWorkbook.SaveAs = Worksheets("Sheet1").Range("A1").Value
End If
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

(remove xxx from email address if mailing direct)

"Tuukka" wrote in message
...
Hi,
is it possible to automatically name workbooks so that it gets its name

from
ie. shell A1? Workbook is saved to prevent unwanted actions but still

users
would need to name each workbook.





All times are GMT +1. The time now is 12:46 AM.

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