By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,046 Members | 1,350 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,046 IT Pros & Developers. It's quick & easy.

Export report to Excel with code?

P: n/a
Is it possible to export a report to an excel spreadsheet using code.

Thanks for any help.
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.