What is the syntax to pick a specifcally named sheet to paste to instead of the "active sheet". The sheet name would be "2002". What I have so far will copy info from a database and paste it into the active sheet:
Option Explicit
Sub GetData2()
Dim cnt As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim xlWs As Object
Dim recArray As Variant
Dim strDB As String
Dim fldCount As Integer
Dim recCount As Long
Dim iCol As Integer
Dim iRow As Integer
' Set the string to the path of your database
strDB = "\\\\Quartz\\Common\\Comptrol\\Corp_Rep\\MONTHEND\\2002\\Monthly Stewardship\\Stewardship Master Files\\Costbudget.mdb"
' Open connection to the database
cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDB & ";"
' Open recordset based on Cost and Budget query
rst.Open "Select * from qryCOSTBudget 2002", cnt
' Set the sheet where data will be copied
Set xlWs = "2002"
Help Me Obi Wan Kenobi, You're My Only Hope.
Option Explicit
Sub GetData2()
Dim cnt As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim xlWs As Object
Dim recArray As Variant
Dim strDB As String
Dim fldCount As Integer
Dim recCount As Long
Dim iCol As Integer
Dim iRow As Integer
' Set the string to the path of your database
strDB = "\\\\Quartz\\Common\\Comptrol\\Corp_Rep\\MONTHEND\\2002\\Monthly Stewardship\\Stewardship Master Files\\Costbudget.mdb"
' Open connection to the database
cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDB & ";"
' Open recordset based on Cost and Budget query
rst.Open "Select * from qryCOSTBudget 2002", cnt
' Set the sheet where data will be copied
Set xlWs = "2002"
Help Me Obi Wan Kenobi, You're My Only Hope.