Copy paste to Word 2016 and preseve formatting

Posted on 2016-09-26
Medium Priority
Last Modified: 2016-10-18
I want to copy paste some color-coded VBA code (via Crayon Syntax Highlighter on Wordpress site) to a Word 2016 document.

When I do it the usual way it loses the formatting.

Is there a way to paste and keep the beautiful color-coding please? (sample attached)

Question by:hindersaliva
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 41816475

Author Comment

ID: 41816502
Thanks. But it doesn't work for me. I used 'Keep Source Formatting' from Paste Options.

The sample code is here

Does it work for you? Anybody?

LVL 77

Expert Comment

ID: 41816682
The colours are not in the saved text, but are the result of interpretation by the VBA editor.

You can do it with Notepad++. You can download and use it freely,

Export the code to a .bas file in the VBA IDE and open it with Notepad++. If it isn't immediately coloured, chose VB as the Language setting
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Author Comment

ID: 41816712
Graham, I need the code for a teaching book I'm writing in Word 2016. I'd like the code to look nice and pretty as in the Syntax Highlighted code on my Wordpress site.

I'm wondering, is there a 'syntax highlighter' that's a sort-of-plugin for Word?
LVL 18

Accepted Solution

xtermie earned 2000 total points (awarded by participants)
ID: 41816781
You can use the Windows snipping tool to get the code as is (formatted) and paste it in word as an image
That could be very helpful when writing a book as you won't be able to edit the code by mistake while writing the book

Author Comment

ID: 41816863
Good idea, xtermie. Thanks.
LVL 18

Expert Comment

ID: 41847955
Author stated solution provided was a great idea :)

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

In this article, I will demonstrate that how to do a PST migration from Exchange Server to Office 365. This method allows importing one single PST, or multiple PST's at once.
I tried to use the SharePoint app to Import a Spreadsheet and import an Excel sheet into a Team site made in SharePoint 2016. But that just resulted in getting an error message 'Unknown Error'...
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

621 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