Results 1 to 4 of 4

Word macro for inserting coloured text

Threaded View

  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:

    Private Sub AddDel(B$, a$)
        Dim strSel$
        strSel$ = WordBasic.[Selection$]()
        If WordBasic.[Right$](strSel$, 1) = " " Then
            strSel$ = WordBasic.[Left$](strSel$, Len(strSel$) - 1)
        End If
        strSel$ = B$ + strSel$ + a$
        WordBasic.Insert strSel$
    End Sub
    and several versions of:

    Sub PersonDeixisTag()
    '
    ' PersonDeixisTag Macro
        AddDel "<Person_Deixis>", "</Person_Deixis>"
    End Sub
    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.

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