Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

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).Headers.Item(wdHeaderFooterPrimary).LinkToPrevious:= OleVar;
 WdDoc.Sections.Item(y).Footers.Item(wdHeaderFooterPrimary).LinkToPrevious:= OleVar;
 WdDoc.Sections.Item(y).Headers.Item(wdHeaderFooterEvenPages).LinkToPrevious:= OleVar;
 WdDoc.Sections.Item(y).Footers.Item(wdHeaderFooterEvenPages).LinkToPrevious:= 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
0
LauraPerez
Asked:
LauraPerez
1 Solution
 
BlackTigerXCommented:
this should give you a good start

http://www.djpate.freeserve.co.uk/AutoWord.htm
0
 
moduloCommented:
PAQed with no points refunded (of 125)

modulo
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now