Jan 5, 2009 #1 Zonie32 Technical User Joined Jan 13, 2004 Messages 242 Location US I have a simple query as a command button. I just want to be able to click the button and have the query open in Excel 2003 format. Anyone have an easy solution? Thanks in advance!
I have a simple query as a command button. I just want to be able to click the button and have the query open in Excel 2003 format. Anyone have an easy solution? Thanks in advance!
Jan 5, 2009 #2 sxschech Technical User Joined Jul 11, 2002 Messages 1,034 Location US The docmd will export the data to an excel file. The Follow Hyperlink will open up the excel file. Code: ... ... DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "QUERYNAME", "c:\temp\EXCELNAME.xls", True FollowHyperlink "c:\temp\EXCELNAME.xls", , True, False ... ... Upvote 0 Downvote
The docmd will export the data to an excel file. The Follow Hyperlink will open up the excel file. Code: ... ... DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "QUERYNAME", "c:\temp\EXCELNAME.xls", True FollowHyperlink "c:\temp\EXCELNAME.xls", , True, False ... ...
Jan 5, 2009 #3 alvechurchdata Programmer Joined Nov 8, 2003 Messages 1,737 Location GB Thanks for the tip. In the past I've done this the hard way by creating an Excel object: Code: Set gobjExcel = CreateObject("Excel.Application") gobjExcel.Workbooks.Open Filename:="EXCELNAME.xls" gobjExcel.Visible = True I'll try FollowHyperLink next time. Geoff Franklin http://www.alvechurchdata.co.uk Upvote 0 Downvote
Thanks for the tip. In the past I've done this the hard way by creating an Excel object: Code: Set gobjExcel = CreateObject("Excel.Application") gobjExcel.Workbooks.Open Filename:="EXCELNAME.xls" gobjExcel.Visible = True I'll try FollowHyperLink next time. Geoff Franklin http://www.alvechurchdata.co.uk