Exporting Data to Excel and opening the file?

robjones23

Registered User.
Local time
Today, 20:56
Joined
Dec 16, 2004
Messages
66
Hi guys, this might be a quickie, I did a quick search but couldn't find anything :/

Basically my database creates a table which some people would rather analyse within excel because they're not comfortable with access. I can get the table exporting to an xls file no problem, howeevr what I would like is for the database to export the file and open the file in excel at the same time so the user doesn't need to open up excel and find the file etc...

Any ideas??
 
Code:
Private Sub cmdExport_Click()
    Const QueryName As String = "MyQuery"
    Const PathName As String = "Y:\MySheet.xls"
    Const SheetType As Byte = acSpreadsheetTypeExcel9
    DoCmd.TransferSpreadsheet acExport, SheetType, QueryName, PathName, True
    Application.FollowHyperlink PathName
End Sub
 
Thankyou as always you're a great help!

Rob.
 

Users who are viewing this thread

Back
Top Bottom