View Single Post
 
Old 05-29-2014, 07:07 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit 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

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