Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |