CodeColorer

On JP’s recommendation I’m trying CodeColorer for syntax highlighting.

Public Sub LoadFromFile()
   
    Dim xmlDoc As MSXML2.DOMDocument
    Dim xmlNodes As MSXML2.IXMLDOMNodeList
    Dim xmlNode As MSXML2.IXMLDOMNode
    Dim i As Long
    Dim clsRandom As CRandom
   
    Set xmlDoc = New MSXML2.DOMDocument
    xmlDoc.Load Environ(“USERPROFILE”) & “My DocumentsMy DropboxwcdkSampleData.xml”
    Set xmlNodes = xmlDoc.documentElement.selectNodes(“//SampleDatum”)
   
    For i = 0 To xmlNodes.Length – 1
        Set xmlNode = xmlNodes.Item(i)
        Set clsRandom = New CRandom
       
        clsRandom.RandType = xmlNode.selectSingleNode(“RandType”).nodeTypedValue
        clsRandom.Name = xmlNode.selectSingleNode(“Name”).nodeTypedValue
        clsRandom.Min = xmlNode.selectSingleNode(“Min”).nodeTypedValue
        clsRandom.Max = xmlNode.selectSingleNode(“Max”).nodeTypedValue
        clsRandom.Decimals = xmlNode.selectSingleNode(“Decimals”).nodeTypedValue
        clsRandom.Sequential = xmlNode.selectSingleNode(“Sequential”).nodeTypedValue
        clsRandom.Skip = xmlNode.selectSingleNode(“Skip”).nodeTypedValue
        Me.Add clsRandom
       
    Next i
End Sub

When I installed it, it said that there was a conflict with my existing highlighter. I was hoping that I wouldn’t have to disable the old one because it will make my existing code look ugly. I suppose I could do an update query on all the old posts. Sounds dangerous.

Posted in Uncategorized

18 thoughts on “CodeColorer

  1. Well, the code looks good. How about in the comments?

    Sub test()
       
        If 1 > 2 Then
            ‘do something
       ElseIf 1 < 2 Then
            Exit Sub
        Else
            MsgBox “this” & “that”
        End If
       
    End Sub
  2. Good morning, Dick –

    Testing “not equals”

    Function baseconv(InputN, BaseN)
    ‘http://support.microsoft.com/kb/135635
      Dim quotient, remainder As Single
       Dim Answer As String
       quotient = InputN   ‘ Set quotient to number to convert.
      remainder = InputN  ‘ Set remainder to number to convert.
      Answer = “”
     
       Do While quotient <> 0   ‘ Loop while quotient is not zero.
         remainder = quotient Mod BaseN
          quotient = Int(quotient / BaseN)
          Answer = remainder & Answer
       Loop
       baseconv = Val(Answer)   ‘ Convert answer variable to a number.

    End Function

    …mrt

  3. Ugh, WordPress mangled my comment. But you get the idea: Replace the original opening code tag with the new one (in comments and posts), and replace the closing code tag with the new closing tag.

  4. When I started my blog I tried a few code formatters, but I couldn’t find one that didn’t totally suck. I’ve reverted to using <pre> tags around code, and unless I specifically highlight a keyword or line of code by hand, it’s all monochromatic.

    This CodeColorer thing looks pretty good.

  5. Dick –

    What is your VBE font? and what’s above?

    I’ve run with Courier New so long, it may be time for a change ;-)

    …mrt

  6. I really like that I can use code tags with this. Correct me if I’m wrong, but if I get rid of this plug in, all my code will revert to normal code tag formatting, which is better than plain text.


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.