title: How to pre-select an e-mail profile when opening Outlook from Excel?
body: <p>I send an e-mail based on an Excel sheet using VBA code.</p>
  <p>I have three e-mail profiles so I am prompted to choose a profile before Outlook opens.  When I open Outlook normally I am asked to chose one of the three profiles.
  <a href="https://i.stack.imgur.com/h7eDQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h7eDQ.png" alt="The picture is from the prompt I get when executing the VBA code." /></a></p>
  <p>How can I pre-select the profile, so I am not prompted every time?</p>
  <p>It works if Outlook is open from the beginning.</p>
  <p>Also, how do I delete the PDF after I have attached the PDF to the e-mail?</p>
  <pre class="lang-vb prettyprint-override"><code>Sub SendPDF()
  
      ChDir &quot;D:\&quot;
      ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
      &quot;D:\Order Form.pdf&quot;, _
      OpenAfterPublish:=False
  
      Dim OutlookApp As Object
      Dim OutlookMailitem As Object
      Dim myAttachments As Object
  
      Set OutlookApp = CreateObject(&quot;Outlook.application&quot;)
      'Application.DisplayAlerts = False
      Set OutlookMailitem = OutlookApp.CreateItem(0)
      'Application.DisplayAlerts = True
      Set myAttachments = OutlookMailitem.Attachments
  
      With OutlookMailitem
          .To = &quot;test@test.com&quot;
          .Subject = &quot;Order Form&quot;
          '.send
          .display
          .htmlbody = &quot;Dear Sir/Madam&quot; &amp; .htmlbody
          myAttachments.Add &quot;D:\Order Form.pdf&quot;
      End With
  
      Set OutlookMailitem = Nothing
      Set OutlookApp = Nothing
      
  End Sub
  </code></pre>