Group:  Microsoft Access ยป microsoft.public.access.externaldata
Thread: How to export and add data to an Excel worksheet?

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

How to export and add data to an Excel worksheet?
pokdbz 08.06.2006 18:56:01
I have an Export statement:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"PHQChartQuery", "C:\PHQChart.xls", False

There is a file already in that location named the same thing
I would like to substitute the new data on the worksheet PHQChartQuery that
is already in the file PHQChart.

The reason I would like to do this is I have a graph on that Excel file that
I would like applied to the data I would be putting into it.

When I export it just adds another worksheet called PHQChartQuery1 but does
not have the graph information like it does on PHQChartQuery.

So is this possible?




Re: How to export and add data to an Excel worksheet?
John Nurick <j.mapSoN.nurick[ at ]dial.pipex.com> 09.06.2006 06:09:43
It's possible. You'll need to write Access VBA code that uses Automation
to launch Excel and open the workbook; then open a recordset on the
query and use Excel's CopyFromRecordset method to place the data into
the worksheet.

If you search the web or the newsgroups (e.g. at Google Groups) for some
of the above keywords you should find examples of the sort of coding
involved.

On Thu, 8 Jun 2006 11:56:01 -0700, pokdbz
<pokdbz[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>I have an Export statement:
>DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
>"PHQChartQuery", "C:\PHQChart.xls", False
>
>There is a file already in that location named the same thing
>I would like to substitute the new data on the worksheet PHQChartQuery that
>is already in the file PHQChart.
>
>The reason I would like to do this is I have a graph on that Excel file that
>I would like applied to the data I would be putting into it.
>
>When I export it just adds another worksheet called PHQChartQuery1 but does
>not have the graph information like it does on PHQChartQuery.
>
>So is this possible?
>
>
>

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net