RE: Export from Access 2007 Report to excel
- From: Kathy <Kathy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Nov 2008 10:40:14 -0800
According to http://support.microsoft.com/kb/934833/en-us this functionality
has been disabled by design in Access 2007.
Here's a code snippet of a workaround I use which outputs to a datasheet
that can be copied then pasted into Excel:
Public Function ViewAsSpreadsheet()
On Error GoTo ErrHandler
Dim rptName As String
Dim strSql As String
rptName = Application.CurrentObjectName
strSql = Reports(rptName).RecordSource
If ChkObject("Query", "TempQry") = True Then ' is object defined?
CurrentDb.QueryDefs.Delete "TempQry"
End If
CurrentDb.CreateQueryDef "TempQry", strSql
DoCmd.OpenQuery "TempQry", acViewNormal, acReadOnly
Exit Function
ErrHandler:
......
This gets the query string from the recordsource for the report that is
open, then creates a temporary query using the query string. From there you
can open the query as a datasheet.
"Peter" wrote:
In Access 2003 I could export to an excel file from Report Preview, or by.
using the output to macro command, choosing a Report name, and choosing Excel
2003 format.
the file type of output format does not seem to be included in the
equivalent areas in 2007 (unless I export from a table or query, but not from
a report)
--
Thanks 4 Help
- References:
- Export from Access 2007 Report to excel
- From: Peter
- Export from Access 2007 Report to excel
- Prev by Date: RE: Number Formating
- Next by Date: Access or Excel creating unwanted 'backup of' files.
- Previous by thread: Re: Export from Access 2007 Report to excel
- Next by thread: Import data from a WORD XP form into an Acccess database
- Index(es):
Relevant Pages
|