Creating a new excel workbook

Can someone please help me with the following code:

Dim NewOutputFile As Workbook
Set NewOutputFile = Workbooks.Add(FileName & ".xls")

where FileName = "C:\Documents and Settings\me\My Documents\file.xls"

I want to create a new workbook dynamically and then add new tabs:

NewOutputFile.Sheets.Add ("New tab")

EDIT when I say "workbook" I mean a new excel file

Answers


NewOutputFile.Sheets.Add().Name= "New tab"

Or if you want to add a Worksheet as the last Worksheet:

NewOutputFile.Sheets.Add(After:=NewOutputFile.Sheets(NewOutputFile.Sheets.Count)).Name = "New tab"

Need Your Help

How do i change emacs default font size and font type

emacs emacs23

I am using emacs 23.3. I need to change the font size and font type, can anyone help me.

Preventing Multiple Votes from a single user, with anonymity

android database amazon-web-services database-design

I know this is a vague question, but I suppose I am unsure of where to begin my research.