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

ipad - UISplitViewController strange behaviour of Master split

objective-c xcode cocoa-touch ipad uisplitviewcontroller

I'm developing UISplitViewController application, Master view is embedded into Navigation Controller.

Storage in PhoneGap

database cordova phonegap-plugins

I trying to use PhoneGap for developing a simple app that has some kind of DB with a couple of values and the data is retrieved from there and showed. The thing is, I a newbie in this. I know there...