Create a Microsoft Word Quick Style for a Code Snippet Box

I'm trying to format some text in my Word doc to have a background color of gray. This is for me to have a Quick Style to apply this formatting. I want to use a monospaced font, like Consolas, and have the entire block have a gray background. When I highlight text and set the background color though, it only set the color behind the text, not the area rectangular area the text sits on within the doc layout. How can I do this?


Solution 1:

I've figured out how to do this:

  1. Highlight arbitrary text in the document
  2. In the Styles chunk of the ribbon, Save Selection as new Quick Style...
  3. In the Modify Style dialog, click Format at the bottom.
  4. Select Frame
  5. Set Text Wrapping to Around
  6. Click OK, then in the Format menu select Border
  7. In the Shading tab, pick a Fill with the background color, e.g. gray

Solution 2:

For Office 2007 and 2010, you'll want to use the Shading tool:

enter image description here

That should do what you want.

I don't have an older version of Office handy to check, but you'll probably find the same tool under Format -> Paragraph, or similar menu option.