Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open an ExcelSpreadsheet 1

Status
Not open for further replies.

luceze

Programmer
Apr 26, 2001
842
0
0
US
I have been trying to open a spreadsheet from access after exporting information from a query. I don't get any errors but it doesn't open. The OutputTo command works and opens excel but it erases the pivot tables that I have set up. I was wondering if anyone could look at my code and see what is wrong. (I have the excel 9.0 references)



Private Sub Command0_Click()
Dim XL As Excel.Application
Set XL = New Excel.Application
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "BySchoolReport", "c:\BSS\AdditionalDescriptions.xls"
XL.Workbooks.Open "C:\BSS\AdditionalDescriptions.xls"
End Sub

Oh yeah I have Excel and Access 2000 on a WINNT machine.
 
Try the following:

Code:
Private Sub Command0_Click()

Dim XL As New Excel.Application

DoCmd.TransferSpreadsheet acExport, DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "BySchoolReport", "c:\BSS\AdditionalDescriptions.xls",False
Set XLBook = GetObject("c:\BSS\AdditionalDescriptions.xls")
Set XL = appXLBook.Parent

XL.Workbooks.Open "c:\BSS\AdditionalDescriptions.xls"
XL.Visible = True

End Sub

HTH

cew657
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top