switchboards

S

ssddteam

I have a query called roster. I want to be able to hit a button and it opens
the query in excell
 
J

JohnFol

Make a reference to the Excel Opbect Library and try something like this. .
..

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"QueryName", "c:\FileName", True

Dim oApp As Excel.Application

Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
oApp.Workbooks.Open ("c:\filename.xls")

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub
 
Top