Delphi 5 and Word97 Automation

Posted on 2004-11-30
Last Modified: 2010-04-05
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;
while y <= wdDoc.Sections.Count  do
 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;

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?


Question by:LauraPerez
    LVL 13

    Expert Comment

    this should give you a good start

    Accepted Solution

    PAQed with no points refunded (of 125)

    Community Support Moderator

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now