View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default SheetsInNewWorkbook

"ROn..." wrote in message
oups.com...
Does someone know why this doesn't work in VBA (Excel 97):

lTemp = Application.SheetsInNewWorkbook
Application.SheetsInNewWorkbook = 1
Set wbTarget = Workbooks.Add
Application.SheetsInNewWorkbook = lTemp


Hi Ron,

This works OK for me in all current versions of Excel. Can you give a
bit more detail about what doesn't work when you try it. By the way, this
line of code will do exactly the same as the above for the special case
where you want a new workbook with a single worksheet:

Set wbTarget = Workbooks.Add(xlWorksheet)

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm