View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Igum Igum is offline
external usenet poster
 
Posts: 1
Default Set a Workbook Name from VB

Hi all,

I cannot manage to set a workbook name before save & close. This is my code:
######################################
Set appExcel = CreateObject("Excel.Application")
With appExcel
.WindowState = xlMaximized
.SheetsInNewWorkbook = 3
.Add
.DisplayAlerts = False
End With

appExcel.Workbooks(1).Name="MyFirstBook.xls"
######################################
Unfortunately, when executing the last instruction an error is raised, as
this is a Read Only property. There's a default name which I need to custom,
so I've searched for another one but they all seem to be Read Only ones!! How
would you deal with it?

Many thanks in advance.