Share via

How Do I Turn Off Bold In My Macro?

triptotokyo-5840 36,686 Reputation points Volunteer Moderator
2013-11-21T10:33:51+00:00

1. I have the following macro set up:-

Sub question_181_macro()

'

' question_181_macro Macro

'

'

Selection.Font.Size = 48

Selection.Font.Color = -687816705

Options.DefaultHighlightColorIndex = wdTurquoise

Selection.Range.HighlightColorIndex = wdTurquoise

Selection.Font.Bold = wdToggle

End Sub

2. The above macro works fine.

3. I have now changed the above macro (by editing in Visual Basic) so that it reads as follows:-

Sub question_181_macro()

'

' question_181_macro Macro

'

'

Selection.Font.Size = 10

Selection.Font.Color = wdColorAutomatic

Options.DefaultHighlightColorIndex = wdYellow

Selection.Range.HighlightColorIndex = wdYellow

Selection.Font.Bold = wdToggle

End Sub

4. If I now run the amended macro it does as I intend apart from one thing: it doesn't change the selected text back to non bold characters.

5. How do I amend my macro (in Visual Basic) so that any text against which the macro is run is in non bold characters?

Thanks in advance for any replies.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-11-21T10:51:10+00:00

To set to Bold:

Sub question_181_macro()

'

' question_181_macro Macro

'

'

    Selection.Font.Size = 10

    Selection.Font.Color = wdColorAutomatic

    Selection.Range.HighlightColorIndex = wdYellow

    Selection.Font.Bold = True

End Sub

To make it non-bold change True to False

To combine them

Sub question_181_macro()

'

' question_181_macro Macro

'

'

    Selection.Font.Size = 10

    Selection.Font.Color = wdColorAutomatic

    Selection.Range.HighlightColorIndex = wdYellow

    If Selection.Font.Bold = True Then

        Selection.Font.Bold = False

    Else

        Selection.Font.Bold = True

    End If

End Sub

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful