首页 > 代码库 > WORD自定义宏

WORD自定义宏

自定义快捷键

折叠所有标题

Word选项—自定义功能区—自定义键盘—不在功能区内的命令—ColllapseAllHeadings

 

展开所有标题

Word选项—自定义功能区—自定义键盘—不在功能区内的命令—ExpandAllHeadings

 

全屏快捷键 Alt+V+U, esc退出 可通过录制宏设定F11全屏

 

Word自定义宏

 

Sub 标题1()    Selection.Style = ActiveDocument.Styles("标题 1")End SubSub 标题2()    Selection.Style = ActiveDocument.Styles("标题 2")End SubSub 蓝色文字()    Selection.Font.Color = wdColorBlueEnd SubSub 删除整段()    Selection.MoveDown Unit:=wdParagraph, Count:=1    Selection.MoveUp Unit:=wdParagraph, Count:=1, Extend:=wdExtend    Selection.TypeBackspaceEnd SubSub 显示导航目录()    If ActiveWindow.DocumentMap = True Then        ActiveWindow.DocumentMap = False    Else        ActiveWindow.DocumentMap = True    End IfEnd SubSub 红色文字()    Selection.Font.Color = wdColorRedEnd SubSub 换行()    Selection.EndKey Unit:=wdLine    Selection.TypeParagraphEnd SubSub 全屏显示()    ActiveWindow.View.FullScreen = Not ActiveWindow.View.FullScreenEnd SubSub 标题3()    Selection.Style = ActiveDocument.Styles("标题 3")End SubSub 浅色文字()    Selection.Font.Color = wdColorGray25End SubSub 黑色文字()    Selection.Font.Color = wdColorBlackEnd SubSub 行前插入空行()    Selection.HomeKey Unit:=wdLine    Selection.TypeParagraph    Selection.MoveUp Unit:=wdLine, Count:=1End SubSub 回到前一位置()    Application.GoBackEnd SubSub 复制当前行()    Selection.HomeKey Unit:=wdLine    Selection.EndKey Unit:=wdLine, Extend:=wdExtend    Selection.Copy    Selection.PasteAndFormat (wdFormatOriginalFormatting)    Selection.PasteAndFormat (wdFormatOriginalFormatting)    Selection.MoveLeft Unit:=wdCharacter, Count:=1End SubSub 增强复制()    If Selection.Type = wdSelectionIP Or Selection.Type = wdNoSelection Then  若选择为空        Selection.HomeKey Unit:=wdLine        Selection.EndKey Unit:=wdLine, Extend:=wdExtend        Selection.Copy        复制整行  ‘MsgBox "没有选择"    Else  若选择不为为空        正常操作        Selection.Copy    End IfEnd SubSub 增强剪切()    If Selection.Type = wdSelectionIP Or Selection.Type = wdNoSelection Then  若选择为空        Selection.HomeKey Unit:=wdLine        Selection.EndKey Unit:=wdLine, Extend:=wdExtend        Selection.Cut        剪切整行  ‘MsgBox "没有选择"    Else  若选择不为为空        正常操作        Selection.Cut    End IfEnd Sub

 

WORD自定义宏