View Single Post
 
Old 12-19-2013, 03:50 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

Code:
 
Sub Insert_R_C_into_every_cell()
     ndx = 1
    For Each aTable In ActiveDocument.Tables
    
        ' no. of rows and columns in each table
        Rows = aTable.Rows.Count
        Cols = aTable.Columns.Count
        
        Dim rng As Range
        
        ' insert each cell value into the master table
        For r = 1 To Rows
            For c = 1 To Cols
                ' insert a cell ID into every cell
                cellvalue = "Cell_ID[" & r & ", " & c & "]"
                
                ActiveDocument.Tables(ndx).Cell(r, c).Range.InsertAfter cellvalue
                ActiveDocument.Tables(ndx).Cell(r, c).Range.Font.Hidden = True
            Next
        Next
        Exit For
        ndx = ndx + 1
    Next aTable
 End Sub
Reply With Quote