<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Sending records to Excel using CopyFromRrecordSet</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Report Control : Sending records to Excel using CopyFromRrecordSet]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 15 May 2026 02:02:34 +0000</pubDate>
  <lastBuildDate>Tue, 21 Sep 2010 17:13:10 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=17287</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Sending records to Excel using CopyFromRrecordSet :  Hi Shan,I was mostly interested...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17287&amp;PID=60383&amp;title=sending-records-to-excel-using-copyfromrrecordset#60383</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6028">mstuart</a><br /><strong>Subject:</strong> 17287<br /><strong>Posted:</strong> 21 September 2010 at 5:13pm<br /><br />Hi Shan,<div>I was mostly interested in the <b>CopyFromRecordSet</b> method.</div><div>I've used this with the <b>ADODB.Connection</b> and <b>ADODB.RecordSet</b> objects, and was hoping to just reference the <b>ReportRecords</b> collection/object to the method.</div><div><br></div><div>Reason being:&nbsp;</div><div>1) there may be a lot of records that have to be loaded, Using the clipboard with a large record set, may crash the program.</div><div>2) some columns may be hidden by the user, removing a column from the ReportControl during runtime, and therefore the program has to consider not to send the hidden column(s) to Excel.</div><div>3) Also, I'm using the 1st column as a checkbox. This allows the user to <i>check</i> which records to work with to send to Excel.</div><div><br></div><div>Regards,</div><div>Mark Stuart</div>]]>
   </description>
   <pubDate>Tue, 21 Sep 2010 17:13:10 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17287&amp;PID=60383&amp;title=sending-records-to-excel-using-copyfromrrecordset#60383</guid>
  </item> 
  <item>
   <title><![CDATA[Sending records to Excel using CopyFromRrecordSet :  HI Mark Stuart,  Please Find...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17287&amp;PID=60331&amp;title=sending-records-to-excel-using-copyfromrrecordset#60331</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6244">SHAN</a><br /><strong>Subject:</strong> 17287<br /><strong>Posted:</strong> 21 September 2010 at 1:13am<br /><br /><DIV><DIV>HI Mark Stuart,</DIV><DIV>&nbsp;</DIV><DIV>Please Find the Code below as&nbsp;you requested ....!</DIV><!-- End Member Post --><BR>&nbsp;---------------------------------------------------------------------------</DIV><DIV>Public Sub ReportControlToExcel(Rptcontrol As ReportControl)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim xlObject&nbsp;&nbsp;&nbsp; As Excel.Application<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim xlWB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; As Excel.Workbook<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set xlObject = New Excel.Application<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'This Adds a new woorkbook, you could open the workbook from file also<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set xlWB = xlObject.Workbooks.Add<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Clipboard.Clear 'Clear the Clipboard</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Add Column Headers<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 1 To Rptcontrol.Columns.count<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.ActiveSheet.Cells(1, i).Value = _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "" &amp; Rptcontrol.Columns.Column(i - 1).Caption<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Select All Records<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 0 To Rptcontrol.Rows.count - 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rptcontrol.Rows(i).Selected = True<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Copy Records to ClipBoard<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rptcontrol.Copy<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With xlObject.ActiveWorkbook.ActiveSheet<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Range("A2").Select 'Select Cell A2 (will paste from here, to different cells)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Paste&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Paste clipboard contents</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Clear Selected Records from Selection<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rptcontrol.SelectedRows.DeleteAll<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Clipboard.Clear<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Format excel Columns<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 1 To Rptcontrol.Columns.count<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.ActiveSheet.Columns(i).AutoFit<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.ActiveSheet.Columns(i).HorizontalAlignment = xlCenter<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Format Excel Rows<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.ActiveSheet.Rows(1).Font.Bold = True<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.ActiveSheet.Rows(1).Interior.Color = &amp;HFFC0C0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.ActiveSheet.Rows(2).Select<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Freeze the First Row<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.ActiveWindow.FreezePanes = True<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' This makes Excel visible</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlObject.Visible = True</DIV><DIV><BR>End Sub</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>-----------------------------------------------------------------------------------</DIV><DIV>'To call the Method Use</DIV><DIV><FONT color=#0000cc>&nbsp;</FONT></DIV><DIV><strong><FONT color=#0000cc>call ReportControlToExcel(Reportcontrol1)</FONT></strong></DIV><DIV>--------------------------------------------------------------------------------------</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 21 Sep 2010 01:13:17 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17287&amp;PID=60331&amp;title=sending-records-to-excel-using-copyfromrrecordset#60331</guid>
  </item> 
  <item>
   <title><![CDATA[Sending records to Excel using CopyFromRrecordSet : Hi all,Is there any chance that...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17287&amp;PID=60328&amp;title=sending-records-to-excel-using-copyfromrrecordset#60328</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6028">mstuart</a><br /><strong>Subject:</strong> 17287<br /><strong>Posted:</strong> 20 September 2010 at 5:32pm<br /><br />Hi all,<div>Is there any chance that using the Excel Range.CopyFromRecordSet ReportRecords would send records of the ReportControl to Excel?</div><div>Anyone using this at all? If so, do you have an example VB6 code that shows how?</div><div><br></div><div>Regards,</div><div>Mark Stuart</div>]]>
   </description>
   <pubDate>Mon, 20 Sep 2010 17:32:44 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17287&amp;PID=60328&amp;title=sending-records-to-excel-using-copyfromrrecordset#60328</guid>
  </item> 
 </channel>
</rss>