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 answer As String
Set wbs = Application.Workbooks
msg = "The following worksbooks must be closed before continuing." & Chr(10) & "Do you want to save and close these workbooks?" & Chr(10) & Chr(10)
For Each wb In wbs
If wb.Name <> ThisWorkbook.Name Then msg = msg & wb.Name & Chr(10)
Next wb
MsgBox (msg), 52, "Workbooks Open"
If answer = vbYes Then Call closeOtherWorkbooks
End Sub
Code:
If answer = vbYes Then Call closeOtherWorkbooks
What am I doing wrong?
Thank You
Last edited: