Check the current document count
Sub box() If Documents.Count = 0 Then Proceed = MsgBox("no document.Please open a document.", vbOKCancel + vbExclamation, "Format Report") If Proceed = vbOK Then Dialogs(wdDialogFileOpen).Show If Documents.Count = 0 Then End Else End End If End If End Sub