0
votes

I'm trying to create a VBA Macro in Word that will search for some text and apply a specific style to it. Before I automate it I'm trying to do it manually via the Find and Replace tool. Here's what I'm doing...

  1. Open a word document with the text: This is the first sentence in the word document.
  2. Make the phrase "in the" to be bold.
  3. Open up the Find and Replace Tool via Edit --> Replace.
  4. In the "Find what:" field only have Format: Font:Bold
  5. In the "Replace with:" field only have Format: Style:Heading 1
  6. Click on "Replace All"

Notice how the entire sentence has been changed to "Heading 1". I only wanted the areas in the document that were "bold" to be in "Heading 1" not the whole sentence.

What am I doing wrong?

1
Did you already try Italic format? Without testing it myself I'd guess your result is due to the fact that Heading 1 is paragraph format.Filburt
What does it mean "paragraph format"? Does this work differently?Ann Sanderson
Paragraph means that - as you have seen - will format everything from the beginning of the line to the next line break (in your case the whole sentence).Filburt

1 Answers

1
votes

A Heading is a heading.

If you change any part of the sentence to Heading1 the whole sentence becomes the heading. If you want it to be bigger, my suggestion would be to increase the font size not make it a Heading!