title: Hide screen updating when sending mail with Outlook
body: <p>I have to send reports to over 400 email addresses (on column B). The filepaths for each report are on columns C, D and E.</p>
  
  <p>With this post: <a href="https://stackoverflow.com/questions/8994116/how-to-add-default-signature-in-outlook">How to add default signature in Outlook</a> the signature is added when the <code>.display</code> method is used.</p>
  
  <p>The signature I want to show is for user number 1. I've selected the corresponding signature as a default signature for new messages. </p>
  
  <p>This signature contains a picture, but this doesn't seem to cause any problems.</p>
  
  <p>I wouldn't want the macro to show the mail every time it sends the mail, because I want to avoid the constant blinking on the screen. </p>
  
  <p>I tried to look for something like "hide" method from <a href="https://msdn.microsoft.com/en-us/library/office/ff861252.aspx" rel="nofollow noreferrer">here</a> but didn't find anything useful (.<code>display</code> would run in the background, and it would stay hidden from the user). Other idea was to add <code>application.screenupdating = false</code> and correspondingly <code>true</code> in the end, but this didn't have any impact.</p>
  
  <p>How could I display the email in the background without showing it every time to the user?</p>
  
  <pre><code>Sub sendFiles_weeklyReports()
  
      Dim OutApp As Object
      Dim OutMail As Object
  
      Dim sh As Worksheet
      Dim EmailCell As Range
      Dim FileCell As Range
      Dim rng As Range
  
      Dim lastRow As Long
      Dim timestampColumn As Long
      Dim fileLogColumn As Long
      Dim i As Long
  
      Dim strbody As String
      Dim receiverName As String
      Dim myMessage As String
      Dim reportNameRange As String
  
      Dim answerConfirmation As Variant
  
  Application.ScreenUpdating = False
  
  
      Set sh = Sheets("Report sender")
      Set OutApp = CreateObject("Outlook.Application")
      Set OutMail = OutApp.createitem(0)
      lastRow = sh.Cells(Rows.Count, "B").End(xlUp).Row
      i = 0
      reportNameRange = "C1:E1"
      timestampColumn = 17 'based on offset on EmailCell (column B)!
      fileLogColumn = 18 'based on offset on EmailCell (column B)!
  
      myMessage = "Are you sure you want to send weekly reports?" &amp; vbNewLine &amp; "'" &amp; _
      sh.Range("C2").Value &amp; "', " &amp; vbNewLine &amp; "'" &amp; sh.Range("D2").Value &amp; "' and " &amp; vbNewLine &amp; _
      "'" &amp; sh.Range("E2").Value &amp; "'?"
  
      answerConfirmation = MsgBox(myMessage, vbYesNo, "Send emails")
  
  
      If answerConfirmation = vbYes Then
          GoTo Start
      End If
      If answerConfirmation = vbNo Then
          GoTo Quit
      End If
  
  Start:
      For Each EmailCell In sh.Range("B3:B" &amp; lastRow)
          EmailCell.Offset(0, fileLogColumn).ClearContents
          EmailCell.Offset(0, timestampColumn).ClearContents
  
          Set rng = sh.Cells(EmailCell.Row, 1).Range(reportNameRange)
  
          If EmailCell.Value Like "?*@?*.?*" And Application.WorksheetFunction.CountA(rng) &gt; 0 Then
              With OutMail
                  For Each FileCell In rng
                      If Trim(FileCell) &lt;&gt; "" Then
                          If Dir(FileCell.Value) &lt;&gt; "" Then   'checks if there's a file path in the cell
                              .Attachments.Add FileCell.Value
                                  EmailCell.Offset(0, fileLogColumn).Value = EmailCell.Offset(0, fileLogColumn).Value &amp; ", " &amp; _
                                  Dir(FileCell.Value)
                                  i = i + 1
                          End If
                      End If
                  Next FileCell
  
                  receiverName = EmailCell.Offset(0, -1).Value
                  strbody = "&lt;BODY style=font-size:11pt;font-family:Calibri&gt;&lt;p&gt;Dear " &amp; receiverName &amp; ",&lt;/p&gt;" &amp; _
                  "&lt;p&gt;Please find attached the weekly reports.&lt;/p&gt;" &amp; _
                  "&lt;p&gt;Kind regards,&lt;/p&gt;&lt;/BODY&gt;"
  
                  .SendUsingAccount = OutApp.Session.Accounts.Item(1)
                  .To = EmailCell.Value
                  .Subject = "Weekly Reporting – " &amp; UCase("w") &amp; "eek " &amp; Format(Date, "ww") _
                  &amp; " " &amp; UCase(Left(Format(Date, "mmmm"), 1)) &amp; Right(Format(Date, "mmmm"), _
                  Len(Format(Date, "mmmm")) - 1) &amp; " " &amp; Year(Now)
  
                  .display
                  .HTMLBody = strbody &amp; .HTMLBody
                  .Send
                  EmailCell.Offset(0, timestampColumn).Value = Now
  SkipEmail:
              End With
  
              Set OutMail = Nothing
          End If
      Next EmailCell
  
      Set OutApp = Nothing
  
  Application.ScreenUpdating = True
  
      Call MsgBox("Weekly reports have been sent.", vbInformation, "Emails sent")
  Quit:
  End Sub
  </code></pre>