Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-2017, 07:48 AM
DEL DEL is offline Formatting information with a specified status Windows 7 64bit Formatting information with a specified status Office 2010 64bit
Novice
Formatting information with a specified status
 
Join Date: Apr 2017
Posts: 1
DEL is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old 04-05-2017, 02:45 PM
macropod's Avatar
macropod macropod is offline Formatting information with a specified status Windows 7 64bit Formatting information with a specified status Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

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]
Reply With Quote
Reply



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
Formatting information with a specified status 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
Formatting information with a specified status Status bar information derohanes Excel 3 10-08-2015 12:36 PM
Formatting information with a specified status Page in status bar is wrong; other status bar errors, as well amz Word 3 08-12-2015 02:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:58 AM.


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