title: Outlook VBA open excel
body: <p>I am trying to open an existing excel sheet from outlook. I can see the workbook open and then it imediately closes again. I have the Excel.Application set to visible. Any ideas? Here is the code. </p>
  
  <pre><code>Function openNewForm(toDoSubject)
      MsgBox ("Called")
      Dim xlApp As Object
      Dim sourceWB As Workbook
      Dim sourceSH As Worksheet
  
      Set xlApp = CreateObject("Excel.Application")
  
      With xlApp
          .Visible = True
          .EnableEvents = False
      End With
  
  
      strFile = "C:\Users\Peter\Documents\ASI\OrderSystem\NewOrderSheet.xlsm"
  
      Set sourceWB = Workbooks.Open(strFile, , False, , , , , , , True)
      Set sourceSH = sourceWB.Worksheets("OrderForm")
      sourceWB.Activate
  End Function
  </code></pre>
  
  <p>Again this code is running in outlook. I want to keep the file open once it opens. </p>