?
Solved

Copy paste to Word 2016 and preseve formatting

Posted on 2016-09-26
7
Medium Priority
?
35 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 23

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
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

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 18

Accepted Solution

by:
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
1
 

Author Comment

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

Expert Comment

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

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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 …
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.

800 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