Lazarus 3.x: OLE Error setting MS Word Document Page Layout lazarus / 34-Windows ---------------------------------------------------------------------- Ralle80 · 2024-10-14 11:15 Hi everyone, Lazarus gives a "EOleException" (Screenshot attached) when trying to set the Page Layout (Left Margin) of a newly created Word (2013) Document. Error is only present in 3.x Versions - program runs fine in 2.0.12. Error message would be translated "LeftMargin is not a reference property". Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit OleError; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComObj; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  private   public   end; var  Form1: TForm1;  WdApp,Dokument:OleVariant;implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);var oleVar:OleVariant;begin WdApp := CreateOleObject('Word.Application'); WdApp.Visible := True; Dokument := WdApp.Documents.Add; Dokument.Activate; oleVar := 36;Dokument.PageSetup.LeftMargin := oleVar;end; end. Anyone know how to solve that ? Thanks !