#1
|
|||
|
|||
names of tables
Dear All,
I would like to, how to get the name of a table? I red earlier, that it is listed in its properties, but I didn't find it. Can anybody help? Thank you |
#2
|
||||
|
||||
Hi hklein,
Tables don't have a 'name' property. They do, however, have a 'title' property which you can access via 'Alt Text' on the tables properties dialogue box.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you, but I don't understand it. How to do it?
In fact, what I need is to define exactly a table in my macro. Index is not the way I could use, as I have to use different templates, where tables for same purposes have different indexes. I do not want to change the code due to the different index, but would like to locate the table by an exact property. If you know, how to change the index to an other value, it is fine for me as well. Thanks |
#4
|
||||
|
||||
Hi hklein,
If you give the table a 'title', you can refer to it in code by that. Alternatively, if the table has some distinguishing feature (eg a particular heading), you can use that. Either way, you'll have to loop through the tables to find the one that matches your criteria.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hi
can you pls show me a coding example, how to give a 'title" toa table? How to change the activedocument.tables(1) to activedocument("mytable") Thank you |
#6
|
||||
|
||||
Hi hklein,
To add a title programmatically, you could use code like: Code:
Sub Demo1() ActiveDocument.Tables(1).Title = "MyTableTitle" End Sub Alternatively, if you want to add a title to a selected table, you can do that through the user interface, or with code like: Code:
Sub Demo2() If Selection.Information(wdWithInTable) = False Then Exit Sub Selection.Tables(1).Title = "MyTableTitle" End Sub Code:
Sub Demo3() Dim oTbl As Table For Each oTbl In ActiveDocument.Tables If oTbl.Title = "MyTableTitle" Then 'Do something with the table Exit For End If Next End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Hi Macropod,
many thanks for your help, I really appreciate it. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
chart names in PP ? | Intruder | PowerPoint | 0 | 12-24-2010 06:05 AM |
Names 2007 | shadad | Excel | 0 | 03-19-2010 02:53 PM |
Names | dguillory | Word | 0 | 12-29-2009 11:00 PM |
Display names | Ineedhelp | Outlook | 1 | 05-12-2009 11:28 PM |
Two Different Names in the Same File | kathy carson | Outlook | 0 | 02-14-2006 01:02 PM |