Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open workbook with one worksheet 1

Status
Not open for further replies.

Tiglet

Technical User
Apr 12, 2002
94
GB
Hi,

How do I open new workbooks with just one worksheet in without changing the default SheetsInNewWorkbook property?

Tiglet

[green]Duct tape is like the force; it has a light side & a dark side, and it holds the universe together. [/green]

 
With worksheet template:

[tt]Set wbk = Workbooks.Add(xlWBATWorksheet)[/tt]

combo
 
combo

Brill,

Have a star!

One question though, what does xlWBATWorksheet actually mean. I notice that rather than being called Book1 etc, the Workbook name is Sheet1. Makes no difference to my code, but I'm intrigued

Tiglet

[green]Duct tape is like the force; it has a light side & a dark side, and it holds the universe together. [/green]

 
Hi Tiglet,
in Workbooks.Add(Template) (Template is optional), Template specifies, how the new workbook is created. If ommited, standard new workbook is added. You can specify file here to use it as a template. You can also use constants (sometimes enumerated):
1 - for worksheet (xlWBATWorksheet)
2 - chartsheet (xlWBATChart)
3 - macro sheet (xlWBATExcel4MacroSheet),
4 - international macro sheet (xlWBATExcel4IntlMacroSheet),
5 - workbook,
6 - module (with workbook),
7 -. old dialogsheet.
For instance, the syntax for dialogsheet is Workbooks.Add(7)

combo


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top