• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1212
  • Last Modified:

VBA Script to print colored word text in black/white

I've got the following problem: I've got a word text where some words are colored. When I want to print the text it should be only black/white (or grayscale).

I think the easiest would be a VBA script which has the following features:
- Save document
- Mark everything
- Copy it in a temporary document
- Set auto as font color
- Print
- Copy the text from the temporary document back
- Delete temporary document

Can anybody post code which is able to do this?

Best regards and thanks a lot,

PS: I know it would be possible to set the printer to grayscale, but I don't want to do this because I only want a little script which is accessible by shortcut.
  • 3
1 Solution
You can try to do it without creating new document.
You can undo color changes after print:
Selection.Font.Color = wdColorAutomatic
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        ManualDuplexPrint:=False, Collate:=False, Background:=True, PrintToFile:= _
        False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
ActiveDocument.Undo 1
abfinfoAuthor Commented:
This customer has such a solution now but they complain sometimes the undo function undos too much (not only the auto colored text). Would it be a possibility to save the document before colorize it and set with this step a "checkpoint" to do a proper undo?

Or do you have an other idea what could be the problem with the undo?
You could try this:
Sub MonoPrint()
    Dim strFullname As String
    strFullname = ActiveDocument.FullName
    ActiveDocument.Range.Font.Color = wdColorBlack
    ActiveDocument.Close wdDoNotSaveChanges
    Documents.Open strFullname
End Sub

Open in new window

abfinfoAuthor Commented:
Great idea :)
abfinfoAuthor Commented:
Thanks for your kind help! :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now