+ Reply to Thread
Results 1 to 4 of 4

Use Excel VBA to change font color of word in Word document

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Use Excel VBA to change font color of word in Word document

    Can someone please help me to modify this code, or supply similar code, to change every instance of an asterisk (*) in a Work document from Excel.

    Help will be greatly appreciated.

    PHP Code: 
        With objDoc
            With Selection
    .Find
                
    While .Execute(FindText:="*"Forward:=True)
                    If .
    Found True Then
                        Selection
    .Font.Color vbRed
                    End 
    If
                
    Wend
            End With
        End With 
    Last edited by VBA_Novice_VBA; 04-02-2023 at 05:52 PM.

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Use Excel VBA to change font color of word in Word document

    Maybe :
    Please Login or Register  to view this content.
    Attached Files Attached Files
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Registered User
    Join Date
    06-13-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Use Excel VBA to change font color of word in Word document

    This code worked for me. Thank you very much!

    PHP Code: 
        With objDoc.Content.Find
            
    .ClearFormatting
            With 
    .Replacement
                
    .ClearFormatting
                
    .Font.Color vbRed
            End With
            
    .Execute FindText:="*"Format:=TrueReplace:=wdReplaceAll
        End With 

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Use Excel VBA to change font color of word in Word document

    You are welcome, thanks for marking the thread as solved.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help! change lots of word document font format.
    By 302 in forum Word Programming / VBA / Macros
    Replies: 10
    Last Post: 06-05-2022, 10:37 PM
  2. Help! change lots of word document font format.
    By 302 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2022, 05:21 AM
  3. Replies: 5
    Last Post: 10-10-2021, 11:49 PM
  4. How do i make the word remove change to font color red. This is outlook vba
    By ioo_ares_ooi in forum Outlook Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2019, 11:44 AM
  5. How do i make the word remove change to font color red. This is outlook vba
    By ioo_ares_ooi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2019, 11:35 AM
  6. Find a word and change font color
    By bbqmikeq in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-28-2012, 12:43 PM
  7. Replies: 3
    Last Post: 03-05-2012, 11:03 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1