For the moment I opens Excel and create cells with values from a database.
But now I want to create several different pages in the same Excel-spreadsheet and load with data depending on the contents in the database.
Is there someone who knows how to create a new page and if it is possible to name the tabbs of the pages?
And also to direct on what page the data should be written.

This is my present code:
------------------------
Set ExcApp = CreateObject("excel.application") 'starting excel
ExcApp.DisplayAlerts = True
Set ExcWB = ExcApp.Workbooks.Add
Set Xls = ExcWB.Worksheets(1)

'Check what fields that is in the databas and create a cell with data in excel.

For Each fl In td.Fields
Index = Index + 1
Xls.Cells(1, Index).Value = fl.Name
Xls.Cells(2, Index).Value = dbTable.Fields(fl.Name)
'Adjust the cellwidth according to contents of database
Maxlength = Len(fl.Name)
If Len(dbTable.Fields(fl.Name)) > Maxlength Then
Maxlength = Len(dbTable.Fields(fl.Name))
End If
Xls.Columns(Index).ColumnWidth = Maxlength + 1
Next

If Err.Number <> 0 Then Exit Sub
On Error Resume Next
Xls.SaveAs filnamn