Excel Sheets

Surjer

Registered User.
Local time
Today, 21:52
Joined
Sep 17, 2001
Messages
232
Hello all,
Does anyone know where I can find some info on (Or is it possible to) create an excel workbook with specific worksheets?

DoCmd.RunSQL ("SELECT GPS_Antennas.* INTO tmptable FROM GPS_Antennas WHERE Assigned_Location = " & Chr(34) & office & Chr(34))
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel3, "TMPTABLE", "c:\book1.xls", True
DoCmd.DeleteObject acTable, "TMPTABLE"

I want to create multiple worksheets for each type of equipment we have..

GPS antenna's is one of them...

I want a separate sheet for each type..

Is this possible??

Jerry
 
Try this:

Code:
'to open your workbook

Dim xlapp as excel.application


set xlapp = createobject("excel.application")
xlapp.workbooks.open ("c:\book1.xls")

'to add a sheet
xlapp.activeworkbook.sheets.add

the add method has a few arguments. Look it up in the help files.

Fuga.
 
Sweet

Thanks for that. That will come in really handy in the future. I was trying to keep away from Automation as it seems to be my nightmare when installing on other machines.

What I figured to work was just stick with:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel3, tbl1, "c:\book1.xls", True

As long as tbl1 does not exist in the workbook it will create a new worksheet for that table.

Thanks,
Jerry
 

Users who are viewing this thread

Back
Top Bottom