[mso] Help with some Code in Word

  • From: "Geoff Culbertson" <glio@xxxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Thu, 19 Apr 2007 22:39:45 +0100

I am starting to learn a little about Visual Basic code but have a long way
to go yet!
 

I have found some code and adapted it for my purposes and use it in a table.
The code  is shown below:-

 

Select Case Selection.Fields(1).Code.Characters(29)

  Case "?"

    Selection.Fields(1).Code.Characters(29) = "R"

    Selection.Fields(1).Code.Characters(29).Font.Color = wdColorRed

  Case "R"

    Selection.Fields(1).Code.Characters(29) = "A"

    Selection.Fields(1).Code.Characters(29).Font.Color = wdColorGold

  Case "A"

    Selection.Fields(1).Code.Characters(29) = "G"

    Selection.Fields(1).Code.Characters(29).Font.Color = wdColorBrightGreen

  Case "G"

    Selection.Fields(1).Code.Characters(29) = "?"

    Selection.Fields(1).Code.Characters(29).Font.Color = wdColorAutomatic

  Case Else

End Select

 

When the code is called by a field cell it shows a ?, which when
double-clicked toggles through R, A, G then back to ?. What I would like to
happen is that the R, A, G should read Red, Amber & Green, however when I
change the letters to the words the code fails to work. Can anyone help
please?

 

What would be even better for me is if the when the R(ed) was selected the
shading of the cell became red, or when A(mber) was selected the shading
became amber etc. Am I being too hopeful?!

 

Regards

 

 

 

-- 

Geoff Culbertson

Petersfield, Hampshire, UK



*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, visit the group's homepage and use the dropdown 
menu at the top.  This will allow you to unsubscribe your email address or 
change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to share files with the group, you must join our Yahoo sister group. 
 This group will not allow for posting of emails, but will allow you to join 
and share problem files, templates, etc.:  
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE 
SHARING ONLY.

If you are using Outlook and you see a lot of unnecessary code in your email 
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************

Other related posts: