View Single Post
 
Old 12-20-2013, 01:24 PM
epid011 epid011 is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Dec 2013
Posts: 12
epid011 is on a distinguished road
Default programmatically inserting hidden text into a Word 2010 table

So I tried the code you sent yesterday on a portion of a "real" data table and it choked on a merged cell after it got past the first row. Any suggestions? See attached doc for table. Thanks in advance for your help.

Code:
 Sub Insert_R_C_into_every_cell()
    Dim Rng As Range, aTable As Table, TblCell As Cell, cellvalue As String
    For Each aTable In ActiveDocument.Tables
        For Each TblCell In aTable.Range.Cells
            With TblCell
                cellvalue = "Cell_ID[" & .RowIndex & ", " & .ColumnIndex & "]"
                Set Rng = .Range
                With Rng
                    .End = .End - 1
                    .Collapse wdCollapseEnd
                    .Text = cellvalue
                    .Font.Hidden = True
                End With
            End With
        Next TblCell
    Next aTable
 End Sub
Attached Files
File Type: docx Table 3.3.6.1 - for testing.docx (17.5 KB, 11 views)
Reply With Quote