How can I do this in delphi?

Posted on 2005-04-27
Last Modified: 2010-04-05

There is some tip on how to maximize the performence using word and ole.

I wounder how I can do this routin in delphi:

Dim oCell As Cell

Application.ScreenUpdating = False
For Each oCell In Selection.Cells
    oCell.Range.Text = "Hi there"
Next oCell
Application.ScreenUpdating = True

End Sub

If I do:

for ix := 1 to WordApp.Selection.Cells.count-1 do
  WordApp.Selection.Cells.Item(px).Range.Text:= 'aaaa';


The selection seems to be modified.

If cells.count is 5 when I start it becomes 1 after the first time
  WordApp.Selection.Cells.Item(px).Range.Text:= 'aaaa';
has run.

Question by:wqclatre
    1 Comment
    LVL 11

    Accepted Solution

    try something like this

          ix: integer;
          for ix := 1 to WordApp.ActiveWindow.Selection.Cells.count-1 do
              WordApp.ActiveWindow.Selection.Cells.Item(ix).Range.Text:= 'aaaa';


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    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…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    732 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

    21 Experts available now in Live!

    Get 1:1 Help Now