Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I open a empty workbook with no sheets?

I am using this line.

myWorkbook = myExcelApp.Workbooks.Add(Excel.XlWBATemplate.xlWBA TWorksheet);

But, it is giving me an empty sheet to start out with. I have also tried
using Type.missing, but that gives me 3 empty sheets.
  #2   Report Post  
Posted to microsoft.public.excel.programming
JK JK is offline
external usenet poster
 
Posts: 9
Default How do I open a empty workbook with no sheets?

Excel requires that an open workbook has at least one visible
worksheet. Sorry, but I don't see a way to have a workbook without any
worksheets.

If you want an empty vessel for some code, you might want to think
about saving your workbook as an excel add-in. But I'm not really sure
what you need, so I hope you find something that works.

-JK

ChartsToBe wrote:
I am using this line.

myWorkbook = myExcelApp.Workbooks.Add(Excel.XlWBATemplate.xlWBA TWorksheet);

But, it is giving me an empty sheet to start out with. I have also tried
using Type.missing, but that gives me 3 empty sheets.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I open a empty workbook with no sheets?

Well, I do have other sheets that I am adding, but I always have this one
sheet named "Sheet1" that I can't seem to do anything with. Is there a way
to Select and Delete it?

"JK" wrote:

Excel requires that an open workbook has at least one visible
worksheet. Sorry, but I don't see a way to have a workbook without any
worksheets.

If you want an empty vessel for some code, you might want to think
about saving your workbook as an excel add-in. But I'm not really sure
what you need, so I hope you find something that works.

-JK

ChartsToBe wrote:
I am using this line.

myWorkbook = myExcelApp.Workbooks.Add(Excel.XlWBATemplate.xlWBA TWorksheet);

But, it is giving me an empty sheet to start out with. I have also tried
using Type.missing, but that gives me 3 empty sheets.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do I open a empty workbook with no sheets?

In Excel, I do this kind of thing:

dim myWorkbook as workbook
set myworkbook = workbooks.add(1) 'single sheet, same as xlwbatworksheet
myworkbook.worksheets(1).name = "DeleteMeLater"
'do a bunch of stuff
'later
application.displayalerts = false
myworkbook.worksheets("deletemelater").delete
application.displayalerts = true

======
If you always add sheets to the right of worksheets(1), you could drop the
naming stuff and just delete the first worksheet.

ChartsToBe wrote:

I am using this line.

myWorkbook = myExcelApp.Workbooks.Add(Excel.XlWBATemplate.xlWBA TWorksheet);

But, it is giving me an empty sheet to start out with. I have also tried
using Type.missing, but that gives me 3 empty sheets.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extra empty workbook opens up when any excel file is open Anindyo Dutta Excel Discussion (Misc queries) 1 February 25th 09 01:19 PM
Open workbook to same worksheet and next empty row inta251 via OfficeKB.com Excel Worksheet Functions 3 February 24th 07 08:00 PM
Search open sheets in workbook and insert into open sheet punx77 Excel Discussion (Misc queries) 0 March 6th 06 05:07 PM
How to avoid opening an empty workbook every time I open a file? Nick Papadakis Setting up and Configuration of Excel 2 February 12th 06 11:55 AM
Open workbook with x number of sheets Robert Christie[_3_] Excel Programming 4 November 11th 04 06:44 PM


All times are GMT +1. The time now is 04:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"