Created
October 20, 2016 20:25
-
-
Save adricnet/b7ba0fec7e2faafaff55a7f84e3dbd1d to your computer and use it in GitHub Desktop.
Normalise VBA code in macros for easier code analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Normalise VBA code in macros for easier code analysis, @adricnet | |
## Remove all the DOS newlines to start | |
/^[[:space:]]*$/d | |
## Add in newlines we want to highlight code blocks | |
s/end function/End Function\n/i | |
s/end sub/End Sub\n/i | |
## Fix mangled cASe obFUScaTioN while we are here | |
s/end if/End If/i | |
s/end for/End For/i | |
s/Function /Function /i | |
s/Sub /Sub /i | |
s/set /Set /i | |
s/if/If/i | |
s/then/Then/i | |
s/end /End /i | |
s/for /For /i | |
s/loop/Loop/i | |
s/dim /Dim /i | |
s/next/Next/i | |
s/do while/Do While/i | |
s/do until/Do Until/i | |
s/next/Next/i | |
s/timer/Timer/i | |
s/second/Second/i | |
s/\.open/.Open/i | |
s/\.write/.Write/i | |
s/\.close/.Close/i | |
s/\.send/.Send/i | |
s/resume next/Resume Next/i | |
s/on error/On Error/i | |
s/\.savetofile/.SaveToFile/i | |
s/\.createtextfile/.CreateTextFile/i | |
s/\.openastextstream/.OpenAsTextStream/i | |
s/\.responsebody/.ResponseBody/i | |
s/\.atendofstream/.AtEndOfStream/i | |
s/\.environment/.Environment/i | |
s/\.getfile/.GetFile/i | |
s/\.run/.Run/i | |
s/\=createobject/=CreateObject/i | |
s/thisdocument\./ThisDocument./i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment