How do you Display Code Snippets in Microsoft Word?

Share this article!

In this article, we will answer the question: How do you Display Code Snippets in Microsoft Word?

 

The Sample code snippet we want to include in a Word document

Below, you can see an example of a code snippet to be included in our Word document:

SELECT *
FROM table1 t1
INNER JOIN table2 t2 ON t1.ID=t2.ID;
GO

The above code snippet is actually an SQL statement and we want to include it in a word document as a snippet.

 

How to include the code snippet in a Word document

The easiest way to include the above code snippet in a Word document, is to insert it as an object.

Therefore, in order to do this, you need to follow the below steps, within your Word document:

  • Navigate to the “Insert” tab in the Word ribbon (menu)
  • Click on “Object”
  • Select “OpenDocument Text” and click OK – a new Word window/doc launches

How do you Display Code Snippets in Microsoft Word? - Article on TechHowTos.com

 

  • Within the new Word window:
    • Type or paste your code with no spacing
    • Select all text and add a border (outside borders)
    • Select all text and add shading (gray for example)
    • Exit the document

How do you Display Code Snippets in Microsoft Word? - Article on TechHowTos.com

 

  • After you perform the above, you can see that you will return to the original Word document, and this time, a formatted code snippet box with the text you pasted/typed, will be displayed.

How do you Display Code Snippets in Microsoft Word? - Article on TechHowTos.com

 

 

Featured Online Courses:

 

Read also:

 

Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Loading...

Reference: TechHowTos.com (https://www.techhowtos.com)

© TechHowTos.com