Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2014, 07:07 PM
macropod's Avatar
macropod macropod is offline Macro for changing formatting of certain parts of a word Windows 7 32bit Macro for changing formatting of certain parts of a word 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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for changing formatting of certain parts of a word Need macro to merge files in Word and preserve formatting Carolin Word VBA 3 12-14-2014 04:01 AM
Macro for changing formatting of certain parts of a word Formatting Painter Issues - Changing Font Styles in .dot 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
Macro for changing formatting of certain parts of a word Formatting changing constantly in Word sitash Word 1 04-16-2013 02:47 AM
Macro for changing formatting of certain parts of a word Formatting changing randomly Franuzz Word 1 07-14-2011 04:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:16 PM.


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