#1
|
|||
|
|||
Formatting information with a specified status
Hi! I am working on a word template which contains tables and text that decribe each item. The item also has a status which can be work, in analysis, rejected etc. I need to format in light grey the whole Information and table that has "rejected" status and delete the other statuses(I only need the rejected status to be shown in the document). I am a newbie in VBA and really need your help. How can I navigate through the tables and format only the section regarding the "rejected" status?
|
#2
|
||||
|
||||
Assuming the data you want to work on are in the tables, you could use a macro like:
Code:
Sub Demo() Application.ScreenUpdating = False Dim Tbl As Table, r As Long For Each Tbl In ActiveDocument.Tables With Tbl .Shading.BackgroundPatternColorIndex = wdGray25 For r = .Rows.Count To 2 Step -1 If Split(.Cell(r, 1).Range.Text)(0) = "rejected" Then .Rows(r).Delete Next End With Next Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formatting a word document to be able to insert pre-determined section headings and information | glover_gooner | Word | 0 | 02-23-2017 06:41 AM |
How do I activate the status bar? | rbantjes | Word | 2 | 06-29-2016 04:04 PM |
Conditional Formatting showing Tracking Status | brucesw | Outlook | 0 | 12-01-2015 03:21 AM |
Status bar information | derohanes | Excel | 3 | 10-08-2015 12:36 PM |
Page in status bar is wrong; other status bar errors, as well | amz | Word | 3 | 08-12-2015 02:27 PM |