title: Opening an Outlook .msg file with Excel VBA
body: <p>I have the following code </p>
  
  <pre><code>Sub Kenneth_Li()
      Dim objOL As Outlook.Application
      Dim Msg As Outlook.MailItem
  
      Set objOL = CreateObject("Outlook.Application")
      inPath = "C:\Users\SiliconPlus\Desktop\Si+ Contact Lists\Contact_Si+"
  
      thisFile = Dir(inPath &amp; "\*.msg")
      Do While thisFile &lt;&gt; ""
  
          'Set Msg = objOL.CreateItemFromTemplate(thisFile)
          'Or
          Set Msg = objOL.OpenSharedItem(thisFile)
  
          Msg.display
  
          MsgBox Msg.Subject
          thisFile = Dir
      Loop
  
  
      Set objOL = Nothing
      Set Msg = Nothing
  End Sub
  </code></pre>
  
  <p>When I use <code>OpenSharedItem</code> it gives a run-time error 438 Object doesn't support this property or method. </p>
  
  <p>When I use <code>CreateItemFromTemplate</code> I get the following error: </p>
  
  <blockquote>
    <p>Cannot open file: AUTO Andy Low Yong Cheng is out of the office (returning 22 09 2014).msg.<br>
    The file may not exist, you may not have permission to open it, or it may be open in another program.<br>
    Right-click the folder that contains the file, and then click properties to check your permissions for the folder.</p>
  </blockquote>