On the Contextures blog, Gregory suggested using the WordPress plugin, CodeColorer, for formatting the Excel VBA code examples.
In Twitter, Dick Kusleika said that he’s using CodeColorer too, and it works well. I decided to test the plug-in here, before installing it on the Contextures blog.
The CodeColorer feature list looks promising, especially these items:
- syntax highlighting of code in comments
- code protect from mangling by WordPress (for example, quotes, double-dashes, etc would look just right as you entered)
Installing the CodeColorer Plugin
The installation was quick and easy, using the WordPress dashboard. After activating the plugin, I went to the its settings page, to see what could be adjusted. What’s the fun in having a new toy, if you don’t try to break it?
There is a preview of the code, at the bottom of the settings panel. I changed the Theme, from the default of Slush and Poppies(!) to Vibrant Ink. The preview only changed after I clicked the Save Options button.
Yikes! That’s not the look I’m going for.
Twitlight (yes, TwiTlight), looked about the same. At the other end of the code formatting scale, Dawn is a bit too subtle.
So, back to Slush and Poppies it is. Is it just me, or would Slush and Puppies be a better name?
The Formatted Code
Here’s the snippet of code that I copied from Excel VBA.
Sub DeleteCustomLists()
' built in lists are not deleted
Dim n As Long
n = Application.CustomListCount
On Error Resume Next
For n = n To 1 Step -1
Application.DeleteCustomList ListNum:=n
Next n
End Sub
And this is how it looked in Excel
Formatted Code in Comments
The CodeColorer plugin is supposed to format the code in the comments too. You can test it here, and please let me know if you have any trouble, or suggestions.
To format your code in the comments, use this syntax:
Thanks!
______________