Hi i am a new learner of VBA
Just wanna know why there is err.clear on the two difference places
Why do i need the first err.clear ? since at the second line , the program just run the dim code. there should be no error arising ?
Function BookOpen(Bk As String) As Boolean
Dim T As Excel.Workbook
Err.Clear
On Error Resume Next
Set T = Application.Workbooks(Bk)
BookOpen = Not T Is Nothing
Err.Clear
On Error GoTo 0
End Function
Just wanna know why there is err.clear on the two difference places
Why do i need the first err.clear ? since at the second line , the program just run the dim code. there should be no error arising ?
Function BookOpen(Bk As String) As Boolean
Dim T As Excel.Workbook
Err.Clear
On Error Resume Next
Set T = Application.Workbooks(Bk)
BookOpen = Not T Is Nothing
Err.Clear
On Error GoTo 0
End Function