Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 12-19-2013, 04:00 PM
macropod's Avatar
macropod macropod is offline programmatically inserting hidden text into a Word 2010 table Windows 7 32bit programmatically inserting hidden text into a Word 2010 table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,536
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try the following:
Code:
Sub Insert_R_C_into_every_cell()
    Dim Rng As Range, aTable As Table, r As Long, c As Long, cellvalue As String
    For Each aTable In ActiveDocument.Tables
        With aTable
            ' insert each cell value into the master table
            For r = 1 To .Rows.Count
                For c = 1 To .Columns.Count
                    ' insert a cell ID into every cell
                    cellvalue = "Cell_ID[" & r & ", " & c & "]"
                    Set Rng = .Cell(r, c).Range
                    With Rng
                        .End = .End - 1
                        .Collapse wdCollapseEnd
                        .Text = cellvalue
                        .Font.Hidden = True
                    End With
                Next
            Next
        End With
    Next aTable
 End Sub
Aside from the application of the range variable, note the variable declarations and other simplifications.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
vba, vba word, word table



Similar Threads
Thread Thread Starter Forum Replies Last Post
programmatically inserting hidden text into a Word 2010 table getting rid of hidden text in MS word allenglishboy Word 1 11-06-2012 05:48 PM
programmatically inserting hidden text into a Word 2010 table Hidden text in table Angel9520 Word Tables 1 05-02-2012 01:00 AM
programmatically inserting hidden text into a Word 2010 table Hidden style applied over already-hidden text. christie Word 1 08-17-2011 09:10 AM
inserting a string of data into an MS Word table??? matto Word VBA 0 07-16-2010 09:35 AM
Programmatically get File Path for currently opened WORD document franferns Word 1 11-26-2009 12:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2026 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft