P
P
pipetto2021-11-20 17:52:41
Macros
pipetto, 2021-11-20 17:52:41

How to write a macro to highlight every first word in every paragraph of the first section of Word?

For Each p In ActiveDocument.Paragraphs
        p.Range.Words(1).Bold = True
    Next p

There is code to highlight the first word of each paragraph. How to make it work only for the first section of the document

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2021-11-20
@pipetto

Sections in Word are Sections
Sections(1) is the first section.
So your code might look like this:

For Each p In ActiveDocument.Sections(1).Range.Paragraphs
p.Range.Words(1).Bold = True
Next p

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question