'Check that a window is open before you access the ActivePresentation object. Sub count() If Windows.Count = 0 Then MsgBox "Please open a presentation before running this macro." End End IfEnd Sub