title: OleObject using Delphi works differently in Office 365 and Office 2013
body: <p>I am developing a small tool using Delphi Pascal to open an XLSX file, and write a cell on it. It behaves differently on a machine using Office 2013 and Office 365.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>var
    ExcelApp: OleVariant;
    anExcelFileName: String;
  begin
    try
      ExcelApp := CreateOleObject('Excel.Application');
      anExcelFileName := 'D:\sample.xlsx';
  
      ExcelApp.Workbooks.Open(anExcelFileName);
      ExcelApp.Visible := True;
  
      ExcelApp.Workbooks[1].Sheets[1].Range['A1'].Value := 'HELLO';
    except
      on E: Exception do
        showMessage('Error on something: ' + E.Message);
    end;
  end;
  </code></pre>
  
  <p>In Office 2013, the code will access file sample.xlsx in drive D, open it, and write HELLO in cell A1.</p>
  
  <p>In Office 365, the code will open two files. First it will open sample.xlsx and it open a new blank workbook, and write HELLO in the new blank workbook.</p>
  
  <p>How to get the old behavior in office 365?</p>