Is it possible to get the cell position/value for a horizontally merged table? It is a fixed table that holds couple of company logos that change to six different versions depending on user selection.
The reason that row 1 has only two cells is that cell 2 or row 1 contains document titles (and these need to be wide).
I have a table of
Row 1: 2 cells
Row 2: 3 cells.
I actually, only need to access (1,1) and (2,3) but this seems to be impossible under VBA!
Thanks.
Robie
table with merged cells
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
table with merged cells
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78880
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: table with merged cells
I have no problem referring to
ActiveDocument.Tables(1).Cell(1, 1)
and to
ActiveDocument.Tables(1).Cell(2, 3)
in a table similar to yours. What problem do you run into?
ActiveDocument.Tables(1).Cell(1, 1)
and to
ActiveDocument.Tables(1).Cell(2, 3)
in a table similar to yours. What problem do you run into?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 508
- Joined: 17 Dec 2010, 03:14
Re: table with merged cells
If you want to be able to quickly find a cell's address (even if mergeing & splitting is is use), you can do so with the following macro:
The address is reported on Word's status bar.
Code: Select all
Sub CellAddress()
'This macro displays the address of a table cell on Word's status bar
If Selection.Information(wdWithInTable) = True Then
If Selection.Cells(1).ColumnIndex > 26 Then
StatusBar = "Cell Address: " & Chr(64 + Int(Selection.Cells(1).ColumnIndex / 26)) & _
Chr(64 + (Selection.Cells(1).ColumnIndex Mod 26)) & Selection.Cells(1).RowIndex
Else
StatusBar = "Cell Address: " & Chr(64 + Selection.Cells(1).ColumnIndex) & _
Selection.Cells(1).RowIndex
End If
End If
End Sub
Paul Edstein
[Fmr MS MVP - Word]
[Fmr MS MVP - Word]
-
- 5StarLounger
- Posts: 656
- Joined: 18 Feb 2010, 14:26
Re: table with merged cells
Thanks. Not sure what it was but I recreated the whole page and it seems to be fine now.HansV wrote:I have no problem referring to
ActiveDocument.Tables(1).Cell(1, 1)
and to
ActiveDocument.Tables(1).Cell(2, 3)
in a table similar to yours. What problem do you run into?