How would you say my code is not working the same way you were looking for ?

BTW, you could use as a function as well.

Code:
Function IsWorkbookOpened(ByVal WorkbookName As String) As Boolean
    
    Dim wbkOpened    As Workbook
    
    On Error Resume Next
    Set wbkOpened = Workbooks(CStr(WorkbookName))
    On Error GoTo 0
    
    IsWorkbookOpened = Not wbkOpened Is Nothing
    
End Function
and call like

Code:
MsgBox IsWorkbookOpened("MyWorkbook.xlsx")