Hi Bill,
Of course you can't change the design time properties ...!
But you can always can seek a way by :
1. Change the caption of active Workbooks from
application class or your macro ...(most of us recognize activeworkbooks name
from it's windows caption)
2. Seek a way this from ApplicationClass from Class Module.
by changing Newworkbook's caption of it's window.
Try this:
'Place this to your ClassModule:
Option Explicit
Public WithEvents appl As Application
'After typing words above choose 'appl' in module mode (General); Class;
'or appl you made then will appear appl's events
Private Sub appl_NewWorkbook(ByVal Wb As Workbook)
Windows(Wb.Name).Caption = "MyNewWorkBook" & r
End Sub
Private Sub appl_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As
Boolean, Cancel As Boolean)
SendKeys CStr((ActiveWindow.Caption)) & ".xls"
End Sub
'Place this to Stdard Module :
Dim AplClass As New AppEventClass '--> must match to your Class module (Name)
' Rename Class1 (name) to AppEventClass
'then run this procedure :
Option Explicit
Public r as long 'sign new series of WB
Private Sub ChangeNewWBName()
r = r + 1
Set AplClass.appl = Application
End Sub
'then try to create new Workbooks from your excel by normal way
Try .... this please and reply... if it's work or not ...
<smile>
halim < (e-mail address removed) >
in-over-his-head-bill said:
I am trying to create a new workbook out of vba. When I try to name it
something beside the default book1,book2, etc... I get a "can't assign to
read-only property" error. How do I name a new workbook?
My code follows with public variables savetofile and savetorange
Public Sub manageoutput_new()
Dim mywb As Workbook, myws As Worksheet
Set mywb = Workbooks.Add
'* problem line is next
mywb.Name = savetofile
mywb.Activate
Set myws = Worksheets.Add
myws.Name = savetorange
End Sub