Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3968970
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:54:26+00:00 2026-05-20T03:54:26+00:00

I’m working on creating a macro in Microsoft Word (2007) for a document that

  • 0

I’m working on creating a macro in Microsoft Word (2007) for a document that contains text such as this:

(1) Bold heading. Normal text.

With this text I’d like to perform a number of transformations upon the first part – (1) Bold heading. – of that text.

While “(1)” and “Bold heading.” have a consistent style (bold and Arial), the space between the two does not (it’s Times New Roman, non-bold).

I thought a search for the below would work, without any format restrictions.

"^13(\([0-9]@\)) (?@)."

Unfortunately, there’s also cases where text is as follows:

(1) Normal text.

For blocks like this, I want to completely skip the text.

Unfortunately, my wildcard search is going to find these instances too, unless I can restrict it by font styles.

If I could normalize the space in the first case, then I could add the Font restrictions on my wildcard search to grab the correct content.

.Text = "^13(\([0-9]@\)) (?@)."
.Font.Name = "Arial"
.Font.Size = 9
.Font.Bold = True

But, I’d need to be able to grab two differently formatted items in a search to normalize that space, which, from my limited knowledge of VBA, doesn’t appear to be possible.

Is there a way to find text with different formatting, in a Word macro?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:54:27+00:00Added an answer on May 20, 2026 at 3:54 am

    I wonder if something like this would suit:

    Dim s As Range
    Dim wd As Range
    Dim BoldHead As Boolean
    Dim doc As Document
    
    Set doc = Word.Documents("Doc2.doc")
    
    For Each s In doc.Sentences
        If s.Words(1).Bold = True Then
            BoldHead = True
            For Each wd In s.Words
                If Trim(wd) <> vbNullString _
                    And wd <> "." _
                    And wd.Bold = False Then
                    BoldHead = False
                End If
            Next
            If BoldHead Then
                Debug.Print s
            End If
        End If
    Next
    

    Note that Word has a nasty enough habit of not counting the numbers, it sees them as automatic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.