Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Dec 2005
    Location
    California
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Highlight But Not Print (Windows 2000 and up)

    I am working on a program that requires the user to answer certain questions, and then the program will then merge it into a word document. I want the user however to be able to see what fields and information has been merged so they can either edit it, or leave it as be. I have been trying unsuccessfully to either highlight, underline, etc. those sections, but not have it print out. For example, I want the text to be highlighted or brought to the users attention on the screen, but when the document prints, only the text, not the highlight prints. If anyone has any ideas how to accomplish this it would be greatly appreciated.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Highlight But Not Print (Windows 2000 and up)

    Welcome to Woody's Lounge!

    That's a tough one - Word is designed to be WYSIWYG (what you see is what you get), so most things you see on the screen will be printed too. Field shading is an exception, but it's not easy to make the merged data into fields.
    It would be possible to use macros, but putting macros in a document is not always acceptable, and if users disable macros on opening the document, you have a problem.

    Just to give you an idea: you could underline the merged data. Run the following macro before printing:

    Sub HideUnderline()
    With ActiveDocument.Content.Find
    .Format = True
    .ClearFormatting
    .Text = ""
    .Replacement.ClearFormatting
    .Replacement.Text = ""
    .Font.UnderlineColor = wdColorAutomatic
    .Replacement.Font.UnderlineColor = wdColorAutomatic
    .Execute Replace:=wdReplaceAll
    .Font.UnderlineColor = wdColorWhite
    .Replacement.Font.UnderlineColor = wdColorWhite
    .Execute Replace:=wdReplaceAll
    End With
    End Sub

    It will make all underlining white, effectively hiding it (assuming the document is printed on white paper). After printing, run this:

    Sub ShowUnderline()
    With ActiveDocument.Content.Find
    .Format = True
    .ClearFormatting
    .Text = ""
    .Replacement.ClearFormatting
    .Replacement.Text = ""
    .Font.UnderlineColor = wdColorAutomatic
    .Replacement.Font.UnderlineColor = wdColorWhite
    .Execute Replace:=wdReplaceAll
    .Font.UnderlineColor = wdColorWhite
    .Replacement.Font.UnderlineColor = wdColorAutomatic
    .Execute Replace:=wdReplaceAll
    End With
    End Sub

    It restores the automatic color for underlining.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Highlight But Not Print (Windows 2000 and up)

    Does hidden text carry over from the "main" document to the resulting merged document? If so, you could put the >> and << characters around your merge fields and create a character style (e.g., FieldIndicator) to mark them with highlighting and the hidden text attribute. This assumes that the users are viewing but not printing hidden text...

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Highlight But Not Print (Windows 2000 and up)

    Hi AaronK,

    If you're printing to a black & white printer, you could colour the mergefields or use a Charformat switch to colour their output, then use the 'Print colors as black on non color printers' setting in Tools|Options|Compatability to cancel out the effect of the colouring at print time. Even without the compatability override, some colours are output fairly close to black anyway on a black & white printer.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

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