![]() |
|
#1
|
||||
|
||||
![]()
You are making it difficult for anyone to help you. You seem determined to not answer very plain questions.
The answer to both questions is vital. I asked you for two criteria and all you come back with is "I'm not sure how it does" and "The colours that they are is irrelevant". Re 1: If you have no basis for deciding either of these things, how do you suppose a macro is going to do it???? Re 2: Crap. I'm not asking these things for my own amusement. Programming works according to rules, not "I'm not sure how it does" and "The colours that they are is irrelevant". As for "I'm just looking for a good template that I can add and remove products from", nothing of what has been discussed so far has anything to do with templates or adding/removing items. The only things that have been discussed concern font attributes. Try the following. But until you can come back with something concrete, I'm not prepared to waste more time on this. Code:
Sub Demo() Application.ScreenUpdating = False Dim StrTxt As String, Rng As Range StrTxt = InputBox("What are the *starting* letters to Find") With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "<" & StrTxt & "*>" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found With .Duplicate .Font.Size = .Font.Size + 2 .Font.Bold = True Select Case Split(.Text, StrTxt)(1) Case "phone" .End = .Start + Len(StrTxt) .Font.ColorIndex = wdDarkYellow Case "mobile" .End = .Start + Len(StrTxt) .Font.ColorIndex = wdYellow Case "desktop" .End = .Start + Len(StrTxt) .Font.ColorIndex = wdGreen Case "laptop" .End = .Start + Len(StrTxt) .Font.ColorIndex = wdPink End Select End With .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Carolin | Word VBA | 3 | 12-14-2014 04:01 AM |
![]() |
Jgreer0315 | Word | 12 | 02-06-2014 05:07 PM |
Using Quick Parts >> Ref >> Field (Third word changing font) | sonny49 | Word | 1 | 01-07-2014 10:01 AM |
![]() |
sitash | Word | 1 | 04-16-2013 02:47 AM |
![]() |
Franuzz | Word | 1 | 07-14-2011 04:12 PM |