Board index » delphi » Word question, inserting a page break

Word question, inserting a page break

Hi,

I got a Word/Delphi question. I'm trying to make Word documents with Delphi
(using the word2000 unit). It works pretty good but I don't know how to
insert a pageBreak( ctrl/enter ). I use macro's in Word to see the Visual
Basic code but I can't get it translated right to Delphi.

inserting a pageBreak (VB):
    Selection.InsertBreak Type:=wdPageBreak

Delphi

    oPageBreak := 'wdPageBreak';

   Selection.InsertBreak( oPageBreak );

I get this error : parameter passed was not a long or short num.
Can somebody help me?

greetings,
Rick

 

Re:Word question, inserting a page break


"Rick" <r.nieuwl...@planet.nl> schrieb im Newsbeitrag
news:3da94f1a$1@newsgroups.borland.com...

Quote
> Delphi

>     oPageBreak := 'wdPageBreak';

>    Selection.InsertBreak( oPageBreak );

> I get this error : parameter passed was not a long or short num.
> Can somebody help me?

Hello,

do not pass the parameter as string!

correct:

var
  oPageBreak : OLEVariant;
[...]
    oPageBreak  := wdPageBreak;

   Selection.InsertBreak( oPageBreak );

Of course, you have to include the unit where "wdPageBreak" is defined in
your uses list.

Bye,
  Ralf

--
mailto:ralf.kai...@wtal.de
http://www.rkaisers.de

Other Threads