LauraPerez
asked on
Delphi 5 and Word97 Automation
Hi, I use Delphi 5 and the word97 unit. I'm trying to formatting a word document ' s header and footer. I'd like to setting the LinkToPrevious property to True in every section on the Sections group.
...
OleVar:= True;
y:=1;
while y <= wdDoc.Sections.Count do
begin
WdDoc.Sections.Item(y).Hea ders.Item( wdHeaderFo oterPrimar y).LinkToP revious:= OleVar;
WdDoc.Sections.Item(y).Foo ters.Item( wdHeaderFo oterPrimar y).LinkToP revious:= OleVar;
WdDoc.Sections.Item(y).Hea ders.Item( wdHeaderFo oterEvenPa ges).LinkT oPrevious: = OleVar;
WdDoc.Sections.Item(y).Foo ters.Item( wdHeaderFo oterEvenPa ges).LinkT oPrevious: = OleVar;
y:= y+1;
end;
....
If I Run the application an error ocurr when y refers to de last section. The error message says something like: "Class Exception. This command is not available. ".
But if I Run using the 'Step Over (F8)' option from the debugger evrerythings ok, no error appear.
I'd like to know what am I doing wrong.
Any ideas please?
Thanks,
Laura
...
OleVar:= True;
y:=1;
while y <= wdDoc.Sections.Count do
begin
WdDoc.Sections.Item(y).Hea
WdDoc.Sections.Item(y).Foo
WdDoc.Sections.Item(y).Hea
WdDoc.Sections.Item(y).Foo
y:= y+1;
end;
....
If I Run the application an error ocurr when y refers to de last section. The error message says something like: "Class Exception. This command is not available. ".
But if I Run using the 'Step Over (F8)' option from the debugger evrerythings ok, no error appear.
I'd like to know what am I doing wrong.
Any ideas please?
Thanks,
Laura
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.djpate.freeserve.co.uk/AutoWord.htm