Closed Thread
Results 1 to 2 of 2

Macro for word font colour

  1. #1
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Macro for word font colour

    Hi Guys,

    I need a macro that goes through every line within a word document.

    when it hits font with a particular colour, it needs to insert a line with text, then searching down the document, until it meets a second colour and then also insert a line with text, and repeat.

    The document contains any type of fonts, but only about 4 or 5 colours. I am only interested in having a line inserted for the first change of occurance of each particular colours.

    eg (for Blue and Red):
    wfefd wefs
    efwd wad
    sefd wd a
    esfsefd waa wd
    sefww dw
    ewqd ddsf
    esfd wdd
    wadwad
    sef ww dad sa
    sefdwd adwd ad a
    redwda
    sefdwd adwd ad a
    sefdwd adwd ad a
    wfefd wefs
    sefdwd adwd ad a
    esfd wdd
    wfefd wefs
    wadwad

    would become:
    wfefd wefs
    Blue:
    efwd wad
    sefd wd a
    esfsefd waa wd
    sefww dw
    ewqd ddsf
    Red:
    esfd wdd
    wadwad
    sef ww dad sa
    Blue:
    sefdwd adwd ad a
    Red:
    redwda
    Blue:
    sefdwd adwd ad a
    sefdwd adwd ad a
    wfefd wefs
    sefdwd adwd ad a
    Red:
    esfd wdd
    wfefd wefs
    wadwad


    I hope that makes sense!
    Ideally I would like to be able to select what the two colours are, and also be able to customise the text inserted before each colour (eg "Red:" could be "Username A:" or "Serial NumberXXXX:")
    Last edited by JimmyWilliams; 06-18-2018 at 05:16 PM.
    Thanks,

    JimmyWilliams

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: Macro for word font colour

    Duplicate thread closed.

    Continue here: https://www.excelforum.com/word-form...nt-colour.html
    Last edited by AliGW; 06-20-2018 at 01:31 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro for word font colour
    By JimmyWilliams in forum Word Formatting & General
    Replies: 3
    Last Post: 07-08-2018, 08:21 PM
  2. Replies: 22
    Last Post: 12-29-2017, 01:19 PM
  3. [SOLVED] Macro failing at conditional formatting font colour
    By RC-AMG in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-12-2015, 12:28 PM
  4. How do I format font colour by a certain word
    By mccartneyd1795 in forum Excel General
    Replies: 1
    Last Post: 07-28-2014, 06:01 AM
  5. [SOLVED] Excel macro- Find replace an itallic font word with a regular word?
    By thisisaboutwork in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2013, 01:48 PM
  6. Macro to control font colour
    By BeerKing in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-08-2011, 07:11 AM
  7. Changing Font Colour if cell is certain word?
    By wuming79 in forum Excel General
    Replies: 5
    Last Post: 07-11-2006, 10:27 PM

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