OK, I have numerous ways to do this from within Excel VBA, but nothing that works from Access VBA. I can clear the entire sheet, but that is not what I want to do. I only want to clear A2:B35. This is what I have that clears the entire sheet. I know there is a way to do this, but can't find an example.
Code:
Function ClearTrendData()
Dim oXL As Object
Dim oBook As Object
Dim oSheet As Object
Set oXL = CreateObject("Excel.Application")
On Error Resume Next
oXL.UserControl = True
On Error GoTo 0
On Error GoTo ErrHandle
Set oBook = oXL.Workbooks.Open("E:\RCADatabase(FE) Current\RCACharting.xlsm")
Set oSheet = oBook.Sheets("TrendData")
oSheet.Cells.Clear
oBook.Save
ErrExit:
oBook.Close
oXL.Application.Quit
Set oXL = Nothing
Set oBook = Nothing
Set oSheet = Nothing
Exit Function
ErrHandle:
oXL.Visible = False
MsgBox Err.Description
GoTo ErrExit
End Function
I am sure that it is a change to the blue lines. Any suggestions?