You are on page 1of 1

Sub Openworkbook_Click()

'Updateby Extendoffice

Dim xWb As Workbook

Dim wbName As String

On Error Resume Next

Set xWb = Workbooks.Open("C:\Users\DT168\Desktop\test\Book2.xlsx")

wbName = xWb.Name

If Err.Number <> 0 Then

MsgBox "This workbook does not exist!", vbInformation, "Kutools for Excel"

Err.Clear

Else

MsgBox "This workbook is opened!", vbInformation, "Kutools for Excel"

End If

End Sub

You might also like