Results 1 to 10 of 10

Thread: Strange character on table range text

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,411
    Location
    Donquick,

    There are several ways to skin the cat. Using a separate function to return cell text is one:

    Sub Test()
        Dim OnRg2 As Range
        With ActiveDocument
            Set OnRg2 = .Tables(1).Rows(1).Cells(1).Range
        End With
        Select Case CellText(OnRg2)
            Case "Low"
                OnRg2.Text = "Low to Moderate"
            Case "Low to Moderate "
                OnRg2.Text = "Moderate"
            Case "Moderate "
                OnRg2.Text = "Moderate to High"
            Case "Moderate to High "
                OnRg2.Text = "High"
            Case "High "
                OnRg2.Text = "Low"
        End Select
    End Sub
    
    Function CellText(ByRef oRng As Word.Range) As String
        CellText = Left(oRng, Len(oRng) - 2)
    End Function
    Last edited by Aussiebear; 12-28-2024 at 07:52 PM.
    Greg

    Visit my website: http://gregmaxey.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •