Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
Code:
Sub isAnyWorkbookOpen()
Dim wb As Workbook
Dim wbs As Workbooks
Dim msg As String
Dim Result
msg = "The following workbook(s) must be closed before continuing:" & Chr(10) & "Do you want to close?" & Chr(10) & Chr(10)
Set wbs = Application.Workbooks
For Each wb In wbs
If wb.Name <> ThisWorkbook.Name Then msg = msg & wb.Name & Chr(10)
Next wb
If Len(msg) > 0 Then
Result = MsgBox(msg, 52, "Workbooks Open")
Else
[COLOR=#008000]'Close MessageBox[/COLOR]
End If
If Result = vbYes Then
wb.Close
Else
End If
End Sub
Code:
Cancel = True
Thank you