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

Export Subreport Data

P: 64
Hi Folks,

I am using CR 8.0 when i export data to excel sheet by using VB6.0, only the fields from the main report is exported, the data/fields from my subreport is not exported. Both data(from main report and subreport) is displaying on the screen. How will the data from the subreports be included in the export?

Thanks
-----------
Mahesh
Nov 26 '07 #1
Share this Question
Share on Google+
1 Reply


P: 6
Hi Mahesh,

'exporting the data to excel
If MsgBox("Are You Sure to Export the Data", vbInformation + vbYesNo, "Rep-Labs") = vbYes Then

Dim objXL As Excel.Application
Dim objWB As Excel.Workbook
Dim objWS As Excel.Worksheet
Dim r As Long
Dim c As Long

Set objXL = New Excel.Application
Set objWB = objXL.Workbooks.Add
Set objWS = objWB.Worksheets(1)

With objWS
'Export main report
For r = 0 To MSHFlexGrid1.Rows - 1
For c = 0 To MSHFlexGrid1.Cols - 1
.Cells(r + 1, c + 1) = MSHFlexGrid1.TextMatrix(r, c)
Next
Next
'Export sub report
For s = 0 To MSHFlexGrid2.Rows - 1
For t = 0 To MSHFlexGrid2.Cols - 1
.Cells(s + r + 2, t + 2) = MSHFlexGrid2.TextMatrix(s, t)
Next
Next

.Cells.Columns.AutoFit

End With

objXL.Visible = True

Set objWS = Nothing
Set objWB = Nothing
Else
End If

May be this code will help you.. to export the data into excel
Nov 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.