+ Reply to Thread
Results 1 to 4 of 4

Word macro for inserting coloured text

  1. #1
    Registered User
    Join Date
    02-07-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Home and Student 2007, Professional (Academic) 2010
    Posts
    2

    Post Word macro for inserting coloured text

    Hi All

    I'm trying to adjust a series of macros I have created for coding my PhD data. I am using XML style tags to mark certain details in transcribed conversations. I'm doing this by highlighting the text I need to tag and clicking a button, tagging the text. eg. "I am Pete playing a wizard", highlight pete and click, creating "I am <proper_name> Pete </proper_name> playing a wizard". I would like to make the tags themselves insert coloured, without changing the colour of the highlighted text. I would like the different tag types to be separate colours, so I can't just find all the text inside <> and change it. I have tagged strings that would looking like:

    "<personal_deixis><Ref_self><occ_self>I</occ_self></ref_self></personal_deixis> am <proper_name><Ref_self><occ_self>Pete</occ_self></ref_self></proper_name>, <personal_deixis><Ref_player><occ_self>NULL</occ_self></ref_player></personal_deixis> < Definite_description><Ref_charself><occ_player>a wizard</occ_player></ref_charself></definite_description>" (("I am Pete playing a wizard"))

    Kind of hard to analyse that way!

    The code I have so far is in two parts. One block of:

    Please Login or Register  to view this content.
    and several versions of:

    Please Login or Register  to view this content.
    I've only gotten the colour to work by changing the highlighted colour, not the tags (this is the first programming I've done in about 12 years!).

    Thank you in advance for the help!
    Last edited by jeffreybrown; 02-08-2013 at 08:37 PM. Reason: Please use code tags...Thanks.

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Word macro for inserting coloured text

    Hi sean,

    Rather than trying to colour the tags as they're inserted, I'd suggest inserting them all & colouring them later. With that approach you could use a macro like:
    Please Login or Register  to view this content.
    The above gives 11 colour options (I assumed you wouldn't want white, automatic, black or grey) on a rotating basis. Simply change the order of the expressions in the StrWords variable to alter which expressions get what colours.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    02-07-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Home and Student 2007, Professional (Academic) 2010
    Posts
    2

    Re: Word macro for inserting coloured text

    Thank you Paul

    Unfortunately this isn't quite what I'm after (I need, say, 3 specific tags to be red, 6 yellow etc). And after doing it manually I realized even coloured trying to analyse all of the data in one document is too much.

    Thanks again, I think I may need to resort to find-and-highlight

    Catherine

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Word macro for inserting coloured text

    Hi sean,

    That, too, is easily accomodated. For example, the following applies one of three colours to the nominated tags:
    Please Login or Register  to view this content.
    FWIW, the code uses Find/Replace just as one might do manually and it would be just as easy to use highlighting as font colouring.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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