G
Guest
I have the following Sub in Access... It works, but I know that a reference
is wrong. Can someone help? I get "Error 1004- Method 'Range' of object
'_Application' failed."
Public Sub FormatLevel2(ByRef xlApp As Excel.Application)
On Error GoTo Err_FormatLevel2
Dim xlc As Object
With xlApp
.Range("A1").Select
.Range(.Selection, .Selection.End(xlToRight)).Select
.Range(Selection, .Selection.End(xlDown)).Select
Set xlc = .Selection
For Each xlc In .Selection
If xlc.Interior.ColorIndex = 6 Then
xlc.AddComment "This is the earliest task plotted for week
specified."
End If
Next xlc
End With
Set xlc = Nothing
Exit_FormatLevel2:
Exit Sub
Err_FormatLevel2:
Call ErrHandler("FormatLevel2 routine", Err.Number, Err.Description)
Resume Exit_FormatLevel2
End Sub
is wrong. Can someone help? I get "Error 1004- Method 'Range' of object
'_Application' failed."
Public Sub FormatLevel2(ByRef xlApp As Excel.Application)
On Error GoTo Err_FormatLevel2
Dim xlc As Object
With xlApp
.Range("A1").Select
.Range(.Selection, .Selection.End(xlToRight)).Select
.Range(Selection, .Selection.End(xlDown)).Select
Set xlc = .Selection
For Each xlc In .Selection
If xlc.Interior.ColorIndex = 6 Then
xlc.AddComment "This is the earliest task plotted for week
specified."
End If
Next xlc
End With
Set xlc = Nothing
Exit_FormatLevel2:
Exit Sub
Err_FormatLevel2:
Call ErrHandler("FormatLevel2 routine", Err.Number, Err.Description)
Resume Exit_FormatLevel2
End Sub