Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 05-23-2014, 02:59 AM
macropod's Avatar
macropod macropod is offline Word VBA Tables Windows 7 32bit Word VBA Tables Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

I believe what's in the links (and other threads you could find with a search) are indeed relevant to your problem, but you don't understand it.

Try the following:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim wdTbl As Table, wdCell As Cell, Rng1 As Range, Rng2 As Range
With ActiveDocument
  For Each wdTbl In .Tables
    For Each wdCell In wdTbl.Range.Cells
      Set Rng1 = wdCell.Range
      Rng1.End = Rng1.End - 1
      If Rng1.Font.Bold = True Then
        Set Rng2 = wdCell.Next.Range
        Rng2.End = Rng2.End - 1
        Select Case Rng1.Text
          Case "Name": Rng2.InsertBefore "<name>": Rng2.InsertAfter "</name>"
          Case "ID.": Rng2.InsertBefore "<ID>": Rng2.InsertAfter "</ID>"
          Case Else
        End Select
      End If
    Next
  Next
End With
Application.ScreenUpdating = True
End Sub
Basically, the above code goes through all tables in the document, looking for cells with 'Name' or 'ID.' as their text, then adds tags (not necessarily xml) before & after whatever's in the next cell.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word VBA Tables Help! Baffled by tables in Word DChord568 Word Tables 5 11-16-2012 01:36 PM
Word VBA Tables Tables in Word angalis428 Word 1 01-06-2012 01:12 PM
Word VBA Tables Excel Tables to MS Word ripcurlksm Word Tables 2 09-09-2011 04:59 AM
Copying tables to MS Word 123 Word Tables 1 03-02-2011 11:25 AM
Word tables nbudd Word Tables 1 05-09-2010 06:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:26 AM.


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