Recent

Author Topic: [SOLVED] Stupid compiler error  (Read 1692 times)

SibBear

  • New Member
  • *
  • Posts: 13
[SOLVED] Stupid compiler error
« on: July 01, 2013, 01:04:33 pm »
I'm creating an application that works with MS Word. Here is the code for setting range boundaries:
Code: [Select]
v1:=Doc1.Paragraphs.Item(8).Range.Start;
v2:=Doc1.Range.End;
r:=doc1.Range(v1,v2);

Compiler gives an error:
Code: [Select]
unit2.pas(237,16) Fatal: Syntax error, "identifier" expected but "END" found
i.e., compiler interprets "End" in "Doc1.Range.End" as the end of cycle/function/etc.
How to avoid this error? Lazarus 1.0.8, FPC 2.6.2.

Thanks,
Michael.
« Last Edit: July 01, 2013, 01:09:49 pm by SibBear »

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Stupid compiler error
« Reply #1 on: July 01, 2013, 01:06:43 pm »

Code: [Select]
v2:=Doc1.Range.End;End is reserved word. Put & before it.
Like this:
Code: [Select]
v2:=Doc1.Range.&End;

SibBear

  • New Member
  • *
  • Posts: 13
Re: Stupid compiler error
« Reply #2 on: July 01, 2013, 01:09:21 pm »
Thanks, it works now.

 

TinyPortal © 2005-2018