LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Copying recordset multiple times using copyfromrecordset

We recently caught this issue but found out after research, that this has
been occuring all year. This code worked in the past, but I am not sure if
there was an Excel update that occurred which changed the behavior of the
script. What we are trying to do is to have a recordset pasted twice into two
seperate worksheets. It is pasting without issue in the first
copyfromrecordset, but then it skips over the second paste (even when
stepping through the code). I know that it is not the worksheet we are
copying into because I can reverse the 'first paste/second paste' (see label
in code below) code and the problem then occurs with the first paste . Here
are code snippets that isolate the problem area:

Dim conn As New ADODB.Connection


rs05.Open "SELECT * FROM [Store Query]", conn, adOpenDynamic

With xlApp
.Visible = True
.Workbooks.Open xlPath & xlBkNamePRINT
Set xlBkPRINT = .ActiveWorkbook
.Workbooks.Open xlPath & xlBkNameQTD
Set xlBkQTD = .ActiveWorkbook
.Workbooks.Open xlPath & xlBkNameWK
Set xlBkWK = .ActiveWorkbook
End With

'First paste
xlBkWK.Activate
xlBkWK.Worksheets("Environmental Step 3").Activate
xlApp.Range("C5").CopyFromRecordset rs05

'Second paste - this works when i paste it above the first paste snippet
xlBkQTD.Activate
xlBkQTD.Worksheets("Environmental Step 3").Activate
xlApp.Range("C5").CopyFromRecordset rs05

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying a range of data multiple times from multiple workbooks sot Excel Programming 1 November 23rd 09 10:21 PM
Copying specific cell ranges from a worksheet multiple times to a newsheet Kris Winntech Excel Programming 3 November 10th 09 01:08 AM
CopyFromRecordset with Filtered ADO recordset Sheldon Penner Excel Programming 2 October 9th 08 03:03 PM
copying a recordset into a variable Chay Excel Programming 0 February 7th 07 05:53 PM
CopyFromRecordset will fail if the recordset array data such as hierarchical recordsets ??? Mike[_108_] Excel Programming 0 June 10th 06 03:05 PM


All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"