WordPress – Adding programming code to a post

Documentation covers this in detail: https://en.support.wordpress.com/code/posting-source-code/

Notes:

  1. Use ‘Text’ tab in post editor to avoid unnecessary formatting tags being added
  2. Structure (using ‘vb’ as an example):

    [code language="vb"] ...your code here... [/code]

Example (using VB):

[code language=”vb”]
Sub ShowAllWorkSheets()
‘Makes all worksheets visible
Dim CWS As Worksheet

For Each CWS In ThisWorkbook.Worksheets
CWS.Visible = xlSheetVisible
Next CWS
End Sub
[/code]

Produces:

Sub ShowAllWorkSheets()
    'Makes all worksheets visible
    Dim CWS As Worksheet
     
    For Each CWS In ThisWorkbook.Worksheets
        CWS.Visible = xlSheetVisible
    Next CWS
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *