Solved

Copy paste to Word 2016 and preseve formatting

Posted on 2016-09-26
7
28 Views
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)

Thanks
Crayon.JPG
0
Comment
Question by:hindersaliva
7 Comments
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 41816475
0
 

Author Comment

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

The sample code is here
http://www.excelomgcookbook.com/4-2/

Does it work for you? Anybody?

Thanks
0
 
LVL 76

Expert Comment

by:GrahamSkan
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
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:hindersaliva
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?
0
 
LVL 17

Accepted Solution

by:
xtermie earned 500 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
1
 

Author Comment

by:hindersaliva
ID: 41816863
Good idea, xtermie. Thanks.
0
 
LVL 17

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

911 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

21 Experts available now in Live!

Get 1:1 Help Now