Sandra Smith
asked on
Late binding add a worksheet and upload recordset from ACCESS 2010 to Excel 2010
Discovered not all the users of the database have references set to Excel library and need to use late binding. But now I cannot get the code to recognizthe worksheet declaration.
Set objExcel = CreateObject("Excel.Applic ation")
Dim wks As objExcel.Worksheet 'DOES NOT WORK
objExcel.Visible = True
Set wbk = objExcel.Workbooks.Add
'objExcel.Visible = True
objExcel.DisplayAlerts = True
Set wks = wbk.Sheets.Add
With wks
.Name = "ProjectData"
.Range("A1").Value = "WorkDate"
.Range("B1").Value = "LastName"
.Range("C1").Value = "FirstName"
.Range("D1").Value = "ProjectName"
.Range("E1").Value = "WorkTime"
.Range("F1").Value = "PayRate"
.Range("G1").Value = "PayTotal"
.Range("H1").Value = "Notes"
End With
i = 2
With wks
Set objExcel = CreateObject("Excel.Applic
Dim wks As objExcel.Worksheet 'DOES NOT WORK
objExcel.Visible = True
Set wbk = objExcel.Workbooks.Add
'objExcel.Visible = True
objExcel.DisplayAlerts = True
Set wks = wbk.Sheets.Add
With wks
.Name = "ProjectData"
.Range("A1").Value = "WorkDate"
.Range("B1").Value = "LastName"
.Range("C1").Value = "FirstName"
.Range("D1").Value = "ProjectName"
.Range("E1").Value = "WorkTime"
.Range("F1").Value = "PayRate"
.Range("G1").Value = "PayTotal"
.Range("H1").Value = "Notes"
End With
i = 2
With wks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your help. this solved my problem.
ASKER