Consulting

Results 1 to 4 of 4

Thread: Select and colour to end of document

  1. #1

    Select and colour to end of document

    I would like to write some code to select from the current cursor position to the end of the document and then colour that selected text to a specific RGB colour. It sounds easy but as a real novice I am still scratching my head on this.

    Any hints would be much appreciated.

    Thanks

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Generally-speaking, applying direct formatting isn't a good idea. Better to manage this kind of thing via Paragraph and/or Character Styles. That said, you could use:
    Sub Demo()
    With Selection
      .EndKey wdStory, wdExtend
      .Font.Color = RGB(100, 127, 255)
      .Collapse wdCollapseStart
    End With
    End Sub
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Great thanks Paul - Will try that when I get home

  4. #4
    Works a treat - Exactly what I wanted to do - Thanks very much!

Posting Permissions

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