ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook_BeforeSave ActiveWorkbook.Name Error (https://www.excelbanter.com/excel-programming/331038-workbook_beforesave-activeworkbook-name-error.html)

sermest

Workbook_BeforeSave ActiveWorkbook.Name Error
 
Hi,

I am trying to setup the file name as below using specific ranges

I wrote below code to Workbook_BeforeSave()

With Worksheets("Vendor")
FName = .Range("F5").Value
ActiveWorkbook.Name = FName & Format(Date, "ddmmyy") & ".xls"
End With

When I click save as I receive below error:
"Can't assign to read-only property"

Please help


Jim Thomlinson[_4_]

Workbook_BeforeSave ActiveWorkbook.Name Error
 
Name is a read only property. You could use save as in it's place but you can
not change the name of the open file. The same as in a spreadsheet you can
not change the name of the open file. Only save it under a different name.
--
HTH...

Jim Thomlinson


"sermest" wrote:

Hi,

I am trying to setup the file name as below using specific ranges

I wrote below code to Workbook_BeforeSave()

With Worksheets("Vendor")
FName = .Range("F5").Value
ActiveWorkbook.Name = FName & Format(Date, "ddmmyy") & ".xls"
End With

When I click save as I receive below error:
"Can't assign to read-only property"

Please help




All times are GMT +1. The time now is 02:26 PM.

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