title: Saving and renaming an Outlook attachment with static name
body: <p>I have this code which saves an attachment to a specific place and renames it to "name.xls"</p>
  
  <pre><code>Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
  Dim objAtt As Outlook.Attachment
  Dim saveFolder As String
  saveFolder = "C:\Users\acheng\Desktop"
       For Each objAtt In itm.Attachments
            objAtt.SaveAsFile saveFolder &amp; "\name.xls"
            Set objAtt = Nothing
       Next
  End Sub
  </code></pre>
  
  <p>A user did something very similar in this thread with .csv files: </p>
  
  <p><a href="https://stackoverflow.com/questions/24244636/vba-outlook-rename-attachments-and-save-to-folder">VBA Outlook - Rename attachments and save to folder</a></p>
  
  <p>I did the same thing, except with a .xls file.  </p>
  
  <p>My script saves and renames the file, but when I try to open the file it says: "'name.xls' is in a different format than specified by the file extension. Verify that it is not corrupt..."</p>
  
  <p>Once I hit Yes and it opens, all the data is in weird symbols.  If I replace &amp; '\name.xls' with '&amp; objAtt.DisplayName' it will properly save the file with it's original name.  </p>
  
  <p>I have double checked that this is a .xls file. Figuring out something more universal (so that the same script works for .xls .xlsx and .xlsm) would also be hugely helpful, but not as big a priority.</p>