title: Excel 2010 automation constants not working in Delphi XE7
body: <p>I am trying to convert a program from Delphi 2010 to Delphi XE7 (32 bit/windows VCL).  Code that used to work in D2010 that automated Excel via late binding OLE now gives the exception "Unable to set the Window state property of the application class" in Delphi XE7, when the app is maximized or minimized.</p>
  
  <p>I am getting the constants xlmaximized and xlminimized from the ExcelXP unit that has these constants:
    xlMaximized = $FFFFEFD7;
    xlMinimized = $FFFFEFD4;</p>
  
  <p>However, if I use the simple constant values -4137 and -4140 the program does work OK.  I realize I must be doing something simple that is wrong.  </p>
  
  <p>Below is some sample code that illustrates the problem.  I tested this and it works in Delphi 2010, but not in Delphi XE7.  I suppose it must be something to do with how constants are handled in newer versions(?) Can someone point me in the right direction?  Thanks in advance!</p>
  
  <pre><code>//XLA is a global variable of type OLEVariant;
  //Program uses ComObj and ExcelXP unit
  
  //This proc just runs or connects to Excel
  
  procedure TForm3.RunExcelClick(Sender: TObject);
  
  begin
    try
      xla := GetActiveOLEObject('Excel.Application');
    except
      try
        xla := CreateOleObject('Excel.Application');
      except
        on E: Exception do
          begin
            ShowMessage(E.Message);
          end;
      end;
      xla.Visible := true;
    end;
  end;
  
  
  procedure TForm3.MaxExcelClick(Sender: TObject);
  begin
     //This is the code that gives the exception
     xla.windowstate := xlmaximized;  //-4137;  Works OK if use this number
  end;
  
  procedure TForm3.MinExcelClick(Sender: TObject);
  begin
     //Or this.  I also get exceptions 
    xla.windowstate := xlminimized ; //-4140; Works OK if use this number
  end;
  </code></pre>