Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I remember that from way back, so I don't think it's new.
Tim "JasonC" wrote in message ... This worked! I wonder if there was an update applied that changed the behavior of the code requiring this addition. Thanks! "Tim Williams" wrote: try rs05.Movefirst before the second CopyFromRecordset Tim "JasonC" wrote in message ... 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copying a range of data multiple times from multiple workbooks | Excel Programming | |||
Copying specific cell ranges from a worksheet multiple times to a newsheet | Excel Programming | |||
CopyFromRecordset with Filtered ADO recordset | Excel Programming | |||
copying a recordset into a variable | Excel Programming | |||
CopyFromRecordset will fail if the recordset array data such as hierarchical recordsets ??? | Excel Programming |