title: Want to Pop up Msg "ABC" instead of Error 5 in vba
body: <p>I have a script which attach only selected files in Outlook, but when the file is not saved it gives error no 5.</p>
  <p>I want a msg popup &quot;Please save your file&quot; instead of coming error msg, below are my script</p>
  <pre><code>Sub SendSDDesignteam()
      Dim objActivePresetation As Presentation
      Dim objSlide As Slide
      Dim n As Long
      Dim strName As String
      Dim strTempPresetation As String
      Dim objTempPresetation As Presentation
      Dim objOutlookApp As Object
      Dim objMail As Object
  
      Set objActivePresetation = ActivePresentation
  
      For Each objSlide In objActivePresetation.Slides
          objSlide.Tags.Delete (&quot;Selected&quot;)
      Next
  
      'Add a tag &quot;Selected&quot; to the selected slides
      For n = 1 To ActiveWindow.Selection.SlideRange.Count
          ActiveWindow.Selection.SlideRange(n).Tags.Add &quot;Selected&quot;, &quot;YES&quot;
      Next n
  
      strName = objActivePresetation.Name
      strName = Left(strName, InStrRev(strName, &quot;.&quot;) - 1)
      strTempPresetation = Environ(&quot;TEMP&quot;) &amp; &quot;\&quot; &amp; strName &amp; &quot;.pptx&quot;
  
      'Copy the active presentation to a temp presentation
      objActivePresetation.SaveCopyAs strTempPresetation
      Set objTempPresetation = Presentations.Open(strTempPresetation)
  
      'Remove the untagged slides
      For n = objTempPresetation.Slides.Count To 1 Step -1
          If objTempPresetation.Slides(n).Tags(&quot;Selected&quot;) &lt;&gt; &quot;YES&quot; Then
             objTempPresetation.Slides(n).Delete
          End If
      Next n
   
      objTempPresetation.Save
      objTempPresetation.Close
   
      'Attach the temp presentation to a new email
      Set objOutlookApp = CreateObject(&quot;Outlook.Application&quot;)
      Set objMail = objOutlookApp.CreateItem(olMailItem)
   
      'Change the email details as per your needs
      With objMail
           .To = &quot;abc@johndoe.com&quot;
           .Subject = &quot;Formatting/Designing Help&quot;
           .Body = &quot;Hi Team,&quot; &amp; vbCr &amp; vbCr &amp; vbTab &amp; &quot;Need this by Date: DD/MM/YYYY, Time : 00:00, Client : XYZ, Comment : NA.&quot;
           .Attachments.Add strTempPresetation
           .Display
      End With
  End Sub
  </code></pre>
  <p>It will be great help if you can help me in this.</p>
  <p>Thanks in advance</p>