Function to test if excel sheet exists

The function below checks if an excel sheet exists with given name. The function works both with Worksheets and Charts sheets. It is included in Excel VBA under both Worksheet and Chart in module modSheetProcedures which is automatically inserted when the function is selected.

Public Function SheetExists(strSheetName As String, Optional wbWorkbook As Workbook) As Boolean
    If wbWorkbook Is Nothing Then Set wbWorkbook = ActiveWorkbook 'or ThisWorkbook - whichever appropriate
    Dim obj As Object
    On Error GoTo HandleError
    Set obj = wbWorkbook.Sheets(strSheetName)
    SheetExists = True
    Exit Function
    SheetExists = False
End Function