摘要:
Sub 程序自动加行号() Dim nLineNum Dim sLindNum As String Dim selRge As Range '以下变量用于"将注释改为蓝色" Dim lineProgramRange As Range Dim commentRange As Range '注释范围 Dim TextLine As String '每一行程序代码(内容) Dim ProgComment As String '每一行程序代码内的注释文字 Dim RgnStart As Long Dim RgnEnd As Long Set selR 阅读全文
摘要:
‘将文件夹下的所有txt文件加载到本文档中Function InsertIntoDoc(strPath as String)Set fso=CreateObject("Scripting.FileSystemObject”) Set objFolder=fso.GetFolder(strPath)Set objFiles =objFolder.FilesStr1=””For Each objFile In objFilesDebug.Print objFile.NameSet fout=fso.OpenTextFile(strPath & “\” & objFile. 阅读全文
摘要:
语法高亮可使用VBA中的查找替换功能,如对于Delphi可先查找到关键字,然后将其设为蓝色即可,具体代码为: 1 Sub Replace1() 2 3 Dim i As Integer 4 5 Dim arr(15) as String 6 7 arr(0)="type" :arr(1)="class" : arr(2) ="unit" : arr(3)="begin" : arr(4)="end" : arr(5)="if" : arr(6)="else" 阅读全文