VBA Script to print colored word text in black/white

Posted on 2011-05-11
Last Modified: 2012-08-14
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.
Question by:abfinfo
    LVL 39

    Expert Comment

    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

    Author Comment

    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?
    LVL 76

    Accepted Solution

    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


    Author Comment

    Great idea :)

    Author Closing Comment

    Thanks for your kind help! :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    My experience with Windows 10 over a one year period and suggestions for smooth operation
    The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
    Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now