I sometimes open a lot of workbooks and want to work on a specific workbook if it is open if not then I need to open it, if it is open how can I make that the active window workbook I am trying this out but can't get it switch windows if it is open or open if it is closed.
Sub isFileOpen()
Dim wkBk As Workbook
Set wkBk = Nothing
On Error Resume Next
Set wkBk = Workbooks("Invoice number vba.xlsm")
On Error GoTo 0
If wkBk Is Nothing Then
MsgBox "The File is not open!"
Else
wkBk = Workbooks.Open("L:\Invoice number vba.xlsm")
MsgBox "The File is open!"
End If
End Sub