Sub NewWorkbook()
Dim myWorkbook As Workbook, myWorksheet As Worksheet
Set myWorkbook = Workbooks.add
Set myWorksheet = myWorkbook.Worksheets.add(After:=myWorkbook.Sheets(myWorkbook.Sheets.Count))
myWorksheet.name = "January"
myWorksheet.range("A1").value = "Sales Data"
myWorkbook.SaveAs FileName:="YourExcel2007File.xlsx"
With myWorkbook
.Worksheets.add After:=.Sheets(.Sheets.Count)
End With
End Sub
|