![]() | Register | FAQ | Members | Social Groups | User Map | Calendar | Search | Today's Posts | Mark Forums Read |
| | | LinkBack | Thread Tools | Search Thread | Language |
| Sponsored Links |
| | #1 |
![]() | Do you think it would be possible (and relatively simple) to create a Macro using VB that looks through a table (or tables) in a word document and everywhere it finds a symbol, it gives the cell a colour? For example, every cell with a '@' gets coloured red. Thanks in advance everyone. Ben |
| |
| | #2 |
![]() | I know this can be done, i have seen it done by a friend i used to work with. He was abit of a Macro Genius, will give him a call see if i can get the info for you. Regards James. |
| |
| | #3 |
![]() Join Date: Oct 2007 Location: Auckland, New Zealand
Posts: 1,702
Thanks: 59
Thanked 250 Times in 227 Posts
Blog Entries: 2 Rep Power: 54 | This does it for a single instance, just need some loop code to get it to do the whole lot at once: Code: Selection.Find.ClearFormatting
With Selection.Find
.Text = "@"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.SelectCell
With Selection.Cells
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorYellow
End With
End With
This may help to, looping code for find: http://visualbasic.about.com/library...ecvbai0303.htm Last edited by SYNACK; 26-06-2008 at 05:07 PM.. |
| |
| | #4 |
![]() Join Date: Aug 2005 Location: London
Posts: 1,120
Thanks: 1
Thanked 116 Times in 101 Posts
Rep Power: 30 | You can loop through the collection of tables and then do the search/replace on the contents of each table - I think that would work OK. Is this just a one-off? If so, you can just use ordinary find/replace to specify a colour for the replacement text - this kind of thing is also handy when you want to change (say) 10 point Arial to 12 point Times Bold and you were evil enough to not use styles :-) |
| |
| | #5 | |
![]() | Quote:
I need this to loop now until it has coloured all the cells... as you will have guessed, I am a complete novice at VB and trying to learn it on the fly. I think I need a 'Do While' or 'Do Until' expression, but am unsure of what statement I need to stop it looping. I need something like - Do Until {can't find '@'} Can you suggest how I might do this please? Thanks again. Last edited by park_bench; 30-06-2008 at 02:36 PM.. | |
| |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add dummy table to censornet | gh256 | How do you do....it? | 0 | 10-12-2007 03:24 PM |
| Time table | thegrassisgreener | General Chat | 35 | 27-11-2007 05:39 PM |
| PHP Loop Table | Jackd | Web Development | 2 | 25-11-2007 01:28 AM |
| Excel Not Recognizing Cells of Equal Value | G_Money | Windows | 2 | 21-06-2007 08:33 AM |
| SQL Table Location G&T | mark80 | MIS Systems | 2 | 16-05-2007 12:46 PM |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search Thread |
|
|






