Board index » delphi » Merging Data from D5 to Word97-Tables (OLE-Container)

Merging Data from D5 to Word97-Tables (OLE-Container)

Hi all,
this is not really a OLE-Automation question, but maybe you have got the
answer.
How do I find out the table's number?
It's not a problem to address a table by its number and put data into
the cells.
If I add a table to a long document (with lots of tables), how can I
find out the index of this new table?

Thanks in advance,

Christoph

 

Re:Merging Data from D5 to Word97-Tables (OLE-Container)


Thus:
Var
    WordTable: Table

WordTable:= WordDocument.tables.add(range, Numcolums, Numrows);
You can get the number from the Document's tables collection, or use the
WordTable variable to reference the table.
Regards Jonathan

Quote
"Camphausen" <ck...@owl-online.de> wrote in message

news:38503206.917E704D@owl-online.de...
Quote
> Hi all,
> this is not really a OLE-Automation question, but maybe you have got the
> answer.
> How do I find out the table's number?
> It's not a problem to address a table by its number and put data into
> the cells.
> If I add a table to a long document (with lots of tables), how can I
> find out the index of this new table?

> Thanks in advance,

> Christoph

Re:Merging Data from D5 to Word97-Tables (OLE-Container)


Quote
> If I add a table to a long document (with lots of tables), how can I
> find out the index of this new table?

when you use the add method to add a new table this method will return a
table object (think of it as a function). This is not clear from the VBA but
is common to adding objects to most collections in VBA. Store this table
object at the time of addition and you can use it all you want, without
needing to know its number.

--
Regards

Dr Allan Harkness
See my Word classes at
http://www.atheroma.freeserve.co.uk/

Other Threads