Formatting text in Word 07 as code

nuge725

New Member
Joined
Jun 16, 2011
Messages
21
Hello everyone,

I am working on a Word document that I use to keep all of my Excel codes in one place so that I remember what they are and what code performs which function. Is there a way to have the VBA code written int he document to appear in a code box like below?

Code:
This is an example of what I'm looking for.

Thanks in advance,

Nuge
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Select the text in Word.
Format it to use Courier New 10 and place a border around it if you wish. Adjust the line spacing and the before and after paragraph spacing.
Create a new style using the selection, and name the style CODE.
Next time you insert some VBA text, select it and apply the CODE style.

Denis
 
Upvote 0

Forum statistics

Threads
1,225,626
Messages
6,186,094
Members
453,337
Latest member
fiaz ahmad

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top