I have the following simple code and have no idea why it is throwing an error:
Dim appExcel As Excel.Application
Dim wkb As Excel.Workbook
Dim wst As Excel.Worksheet
Dim intCount As Integer
Dim strSql As String
Dim strSql2 As String
Dim strSection As String
Dim intSequence As Integer
strSql = …
strSql2 = “…
Set appExcel = CreateObject(“Excel.Application”)
Set rstStudents = CurrentDb.OpenRecordset(strSql, dbOpenDynaset)
Set rstClasses = CurrentDb.OpenRecordset(strSql2, dbOpenDynaset)
Set wkb = appExcel.Workbooks.Add()
Set wst = wkb.Sheets(1)
wst.Activate
appExcel.Visible = True
When it gets to workbooks.add I get “Method add of object workbooks failed”
Any ideas?
Thanks