View Full Version : Naming a new WorkBook
Below is the code I use to add a new workbook - but How can I assign a name to the new workbook - If I try to use the .Name property - I am told readOnly. Any help is appreciated.
Dim NewBookX As Workbook
Set NewBookX = Workbooks.Add
Admin
05-03-2011, 12:40 PM
Hi,
Would this work ?
Dim NewBookX As Workbook
Set NewBookX = Workbooks.Add
If NewBookX.ReadOnly Then
NewBookX.ChangeFileAccess Mode:=xlReadWrite
NewBookX.Name = "NewName"
End If
Excel Fox
05-03-2011, 07:52 PM
Try this....
Dim wbkNew As Workbook
Workbooks.Add(xlWorksheet).SaveAs Filename:="NewName", FileFormat:=&H34 '33 = XLSX, 34 = XLSM
Set wbkNew = Workbooks("NewName.xlsm")
With wbkNew
.ChangeFileAccess xlReadOnly
Kill .FullName
End With
Will do - the other one did not like a full compile - thanks
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.