J
JasonC
Here is the snippet of code (some lines have been left out):
Dim conn As New ADODB.Connection
rs05.Open "SELECT * FROM [05 Store Count Summary]", conn, adOpenDynamic
Dim xlApp As New Excel.Application
With xlApp
.Visible = False
.Workbooks.Open xlPath & xlBkNamePRINT
Set xlBkPRINT = .ActiveWorkbook
.Workbooks.Open xlPath & xlBkNameQTD
Set xlBkQTD = .ActiveWorkbook
.Workbooks.Open xlPath & xlBkNameWK
Set xlBkWK = .ActiveWorkbook
End With
'Part A
xlBkWK.Activate
xlBkWK.Worksheets("Environmental Step 3").Activate
xlApp.Range("C5").CopyFromRecordset rs05
'Part B
xlBkQTD.Activate
xlBkQTD.Worksheets("Environmental Step 3").Activate
xlApp.Range("C5").CopyFromRecordset rs05
I have one recordset that is being pasted into two seperate worksheets. From
stepping through the code, Part A is being executed, but not Part B. There is
no error thrown, the workbook is activated, it goes to the respective tab,
but then nothing is pasted. When I rearrange Part A with Part B (Part B is
executed first), the code works for Part B but not A. This code was working
in the past, but something over the past year broke it. There is no error
being thrown. Thanks in advance for any insight into this issue.
Dim conn As New ADODB.Connection
rs05.Open "SELECT * FROM [05 Store Count Summary]", conn, adOpenDynamic
Dim xlApp As New Excel.Application
With xlApp
.Visible = False
.Workbooks.Open xlPath & xlBkNamePRINT
Set xlBkPRINT = .ActiveWorkbook
.Workbooks.Open xlPath & xlBkNameQTD
Set xlBkQTD = .ActiveWorkbook
.Workbooks.Open xlPath & xlBkNameWK
Set xlBkWK = .ActiveWorkbook
End With
'Part A
xlBkWK.Activate
xlBkWK.Worksheets("Environmental Step 3").Activate
xlApp.Range("C5").CopyFromRecordset rs05
'Part B
xlBkQTD.Activate
xlBkQTD.Worksheets("Environmental Step 3").Activate
xlApp.Range("C5").CopyFromRecordset rs05
I have one recordset that is being pasted into two seperate worksheets. From
stepping through the code, Part A is being executed, but not Part B. There is
no error thrown, the workbook is activated, it goes to the respective tab,
but then nothing is pasted. When I rearrange Part A with Part B (Part B is
executed first), the code works for Part B but not A. This code was working
in the past, but something over the past year broke it. There is no error
being thrown. Thanks in advance for any insight into this issue.