C
clk
I have the following code :
Set appExcel = GetObject(, "Excel.Application")
strTemplatePath = "C:\ywca\january 2009\"
strWorksheet = "CountyTemplate.xlt"
strWorksheetPath = strTemplatePath & strWorksheet
strEmpty = Chr$(34) & Chr$(34)
Set bks = appExcel.Workbooks
'Open the workbook
bks.Add strWorksheetPath
'set reference to a query/table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblCountyTemplate")
lngCount = rst.RecordCount
If lngCount = 0 Then
MsgBox "No Records to Export"
Exit Sub
Else
MsgBox lngCount & " records to export to Excel"
End If
This works great with one worksheet in a workbook. I need it to go to
a specific worksheet. This particular template has three sheets.
Any help would be appreciated.
Set appExcel = GetObject(, "Excel.Application")
strTemplatePath = "C:\ywca\january 2009\"
strWorksheet = "CountyTemplate.xlt"
strWorksheetPath = strTemplatePath & strWorksheet
strEmpty = Chr$(34) & Chr$(34)
Set bks = appExcel.Workbooks
'Open the workbook
bks.Add strWorksheetPath
'set reference to a query/table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblCountyTemplate")
lngCount = rst.RecordCount
If lngCount = 0 Then
MsgBox "No Records to Export"
Exit Sub
Else
MsgBox lngCount & " records to export to Excel"
End If
This works great with one worksheet in a workbook. I need it to go to
a specific worksheet. This particular template has three sheets.
Any help would be appreciated.