INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Lotus Notes Teamroom - lotusscript table text/cell color

Lotus Notes Teamroom - lotusscript table text/cell color

(OP)
Im really new to using lotusscript, and Notes as well. I am using the Teamroom template database and i am running into some troubles coding. i modified the Teamroom in Domino by adding a basic table into the form, and each cell has a field for the user to input data. I need a certain column of the table, which has the heading "Status", to be able to let the user insert R for red, B for blue, G for green, etc. and have it auto set the color of the cell(ideally) to that corresponding color. I've seemed to have an easier time trying to get the font color to change. But this is what i have so far. Hopefully someone can give me some help with the font color, and maybe with the cell color.

I am coding within one of the fields i need to change, it is named "Untitled_4", and i am using the Exiting event, so when they click off the rich text field it runs the code.

So far all I can get to work is this(just for the color red). I know I can improve it by Trimming spaces and setting it to lowercase, but i'm just trying to get the basics to work. It just replaces the letter 'r' with 'RED':

Sub Exiting(Source As Field)
        Dim workspace As New NotesUIWorkspace
        Dim uidoc As NotesUIDocument
        Set uidoc = workspace.CurrentDocument
        If (uidoc.FieldGetText("Untitled_4") = "r") Then
                Call uidoc.FieldSetText (  "Untitled_4" ,  "RED" )
        End If
        End Sub

However, I need the color of the 'Red' text to be red also. This next part is my attempt at it, but I am getting "Type mismatch" and "Object variable not set" errors. I'm Not sure why though. The "type mismatch" error has to do with the data variable but that's all I know.
Sub Exiting(Source As Field)
        Dim session As New NotesSession        
        Dim db As NotesDatabase
        Set db = session.CurrentDatabase
       
        Dim doc As NotesDocument
        Set doc = New NotesDocument(db)
       
        Dim data As Variant
        data = Lcase(Trim(doc.GetItemValue( "Untitled_4" )))
       
        Dim richStyle As NotesRichTextStyle        
        Set richStyle = session.CreateRichTextStyle
        richStyle.bold = True
        richStyle.NotesColor = COLOR_RED
       
        Dim richText As NotesRichTextItem        
        Set richText = doc.GetFirstItem( "Untitled_4" )

        If (data = "r") Then
        Call richText.AppendStyle(richStyle)
        Call richText.AppendText( "RED" )
        End If        
End Sub

Any help would be appreciated. thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close