用word阅读论文做笔记时,一些常用的重复操作,网上也找不到相关的教程,自己琢磨试错了好多次才推敲出来;宏也也有用JS写的,但是那个由于本人太菜琢磨不出来哈哈哈哈哈。
然后,配合自定义快捷键Alt+1、+2、+3…真的巨方便,实测WPS可用,OFFICE尚不清楚。
Sub 高光25灰色()
Selection.Range.HighlightColorIndex = wdGray25
End Sub
Sub 加粗变蓝()
With Selection.Font
.Bold = -1
.BoldBi = -1
.ColorIndex = wdBlue
End With
End Sub
Sub 加粗变红()
With Selection.Font
.Bold = -1
.BoldBi = -1
.ColorIndex = wdRed
End With
End Sub
Sub 高光黄色()
Selection.Range.HighlightColorIndex = wdYellow
End Sub
Sub 绿色底纹()
'两个需要搭配使用
Selection.ParagraphFormat.Shading.Texture = wdTextureSolid
Selection.ParagraphFormat.Shading.ForegroundPatternColor = 14149338
End Sub
Sub 标题1()
Selection.Style = "标题 1"
End Sub
Sub 标题2()
Selection.Style = "标题 2"
End Sub
Sub 标题3()
Selection.Style = "标题 3"
End Sub
Sub 有序列表()
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(1), ContinuePreviousList:=wdContinueList, ApplyTo:=wdListApplyToSelection, DefaultListBehavior:=262144
End Sub
Sub 无序列表()
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries(wdBulletGallery).ListTemplates(1), ContinuePreviousList:=wdContinueList, ApplyTo:=wdListApplyToSelection, DefaultListBehavior:=262144
End Sub
Sub 去底纹()
'VB是没有透明色的,将图案模式设为NONE,再填充色也就是背景色设为自动
Selection.ParagraphFormat.Shading.Texture = wdTextureNone
Selection.ParagraphFormat.Shading.BackgroundPatternColor = wdColorAutomatic
End Sub
Sub 不粗不红不高光()
With Selection.Font
.Bold = 0
.BoldBi = 0
.ColorIndex = wdBlack
.Italic = 0
End With
Selection.Range.HighlightColorIndex = wdWhite
End Sub
Sub 放大()
ActiveWindow.ActivePane.View.Zoom.Percentage = ActiveWindow.ActivePane.View.Zoom.Percentage + 10
End Sub
Sub 缩小()
ActiveWindow.ActivePane.View.Zoom.Percentage = ActiveWindow.ActivePane.View.Zoom.Percentage - 10
End Sub
Sub 比例固定()
ActiveWindow.ActivePane.View.Zoom.Percentage = 150
End Sub
Sub 无格式粘贴()
Selection.PasteAndFormat (wdFormatPlainText)
End Sub
注: 该模块最好保存在 Normal 文件里 可以经常用
学习感受
vb就类似ahk一样的脚本执行程序,但毕竟是通用的,而且还是最大限度地适配word的操作,无论是录制宏操作,还是快捷键触发,都没有word好整