473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Export report to Excel with code?

Is it possible to export a report to an excel spreadsheet using code.

Thanks for any help.
Nov 13 '05 #1
3 5565
ShyGuy wrote:
Is it possible to export a report to an excel spreadsheet using code.

Thanks for any help.


You can export data to Excel using TransferSpreadsheet. Check it out in
help for its arguments.
Nov 13 '05 #2
You cant actually send a report to XL, but you can send the underlying data
as a recordset and then use and XL object to format the spreadsheet to the
extent required. You actually have more functionality in this regard than
you have with a report but you will need to do som VBA programming.

A few key VBA statements that you should investigate if you want to attempt
this follow.

Dim objXL As Object
Dim objWkb As Object
Dim objSht As Object
Dim rs as Recordset

Set objXL = CreateObject("Excel.Application")

Set objSht = objWkb.Worksheets("sheet1")

objXL.Cells(2, 1).CopyFromRecordset rs

(That last statement copies all of the data from the recordset called rs to
a new XL sheet, starting at cell 2,1.)

Dont try and run this code. I have just copied a few lines from a much
longer program to get you started.



"ShyGuy" <sh****@shytown.com> wrote in message
news:ci********************************@4ax.com...
Is it possible to export a report to an excel spreadsheet using code.

Thanks for any help.

Nov 13 '05 #3
Thanks for the reply and the info. I will research this and see what
I can do.

Thanks again,

On Mon, 29 Nov 2004 00:15:09 GMT, "Andrew Chanter"
<he****@radsolutions.com.au> wrote:
You cant actually send a report to XL, but you can send the underlying data
as a recordset and then use and XL object to format the spreadsheet to the
extent required. You actually have more functionality in this regard than
you have with a report but you will need to do som VBA programming.

A few key VBA statements that you should investigate if you want to attempt
this follow.

Dim objXL As Object
Dim objWkb As Object
Dim objSht As Object
Dim rs as Recordset

Set objXL = CreateObject("Excel.Application")

Set objSht = objWkb.Worksheets("sheet1")

objXL.Cells(2, 1).CopyFromRecordset rs

(That last statement copies all of the data from the recordset called rs to
a new XL sheet, starting at cell 2,1.)

Dont try and run this code. I have just copied a few lines from a much
longer program to get you started.



"ShyGuy" <sh****@shytown.com> wrote in message
news:ci********************************@4ax.com.. .
Is it possible to export a report to an excel spreadsheet using code.

Thanks for any help.


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Big Time | last post by:
Hi, I have a report which once opened I would like to automatically export to Excel. I know that this can be done manually however I would like to have the report automatically export to Excel....
1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
6
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel...
2
by: PerryC | last post by:
Is there a way to export an MS Access Report to Word/Excel that looks EXACTLY like it appears in Access? When I export to Excel, only certain data appears, titles, headings... all missing. The...
13
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"...
6
by: smcdonald | last post by:
I have a report that opens up using a pretty complex query. I then pop up a form with combo boxes so the user can apply a filter to the existing report and then refresh the report. I need to export...
3
by: yovation | last post by:
Hi, I have a 3 table database. 1 parent 1 child 1 child of child I would like to get the data into excel as 1 sheet (similar to a grouped report).
3
by: jmarcrum | last post by:
I want to export a report (that contains two separate queries, 1. Current year data, and 2. split-year data) from access into excel, but everytime I run my code and export the data to excel, it looks...
1
by: suresh76 | last post by:
I am having reports generated in jsp with HTML codings in tabular format. On report displayed page I have to use one button , which on click has to export to excel sheet. I tried using below code....
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.