您好,欢迎访问三七文档
Word宏代码集锦Word宏代码集锦一、修改word格式:1、'智能清除选区软回车(换行符)2、'清除选区多余空段3、'合并选区中“,”结束的多余分段4、'清除选区单字节空格5、'清除选区单字节空格6、'清除选区1字空格7、'清除选区段首2字空格8、'清除选区Tab9、'增加选区空格10、'选区段首缩进0字11、'选区段首缩进:2字12、'选区段首缩进转空格—已完美13、'选区段后间距1行14、'选区段后间距1行15、'选区段后间距1行16、'清除选区图片17、'选区硬回车转软回车18、'清除选区软回车19'合并选区段落20、'选区空格转硬回车21、'选区标点半角转全角22、'选区标点全角转半角23、'选区中文句号转半角24、’把文档第一段设置为标题1的格式25、选中的文本横向居中26、缩小字距27、增大字距28、缩小行距29、增大行距30、等高变宽31、等高变窄32、字表间距33、纵向16开34、插入页码35、小写金额转大写金额二、其它1.调整图片大小2.转字体3.转文件格式4、文件加密5、字符替换6、替换引号7、打印为PDF格式文件8、朗读文本9.文献标号上标化10.箭头上方加文字11添加参考文献格式一,参考文献在文档末尾以1.2.3.格式排列12.添加参考文献格式二,参考文献在文档末尾以[1][2][3]格式排列,修改自格式一的代码13.返回正文14.再次引用已有参考文献15.查找被删参考文献遗留引用,16、统计修订的字数17、快速提取脚注内容18、从任意页面编排页码19、批量实现缩放打印20、对文档内容进行顺序排列21、替换Word文档插图的超链接22、为文档的每页添加固定内容23、批量实现图片的等比例缩一、修改word格式:1、'智能清除选区软回车(换行符)Sub智能清除选区软回车()WithSelection.Find.Text=?^l.Replacement.Text=^&^p.Forward=True.Wrap=wdFindContinue.Format=False.MatchCase=False.MatchWholeWord=False.MatchByte=False.MatchAllWordForms=False.MatchSoundsLike=False.MatchWildcards=TrueEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^1^l.Replacement.Text=^&^pEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^l.Replacement.Text=EndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub2、'清除选区多余空段Sub清除选区多余空段()WithSelection.Find.Text=^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub3、'合并选区中“,”结束的多余分段Sub合并选区多余分段()WithSelection.Find.Text=,^p.Replacement.Text=,.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=、^p.Replacement.Text=、.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub4、'清除选区单字节空格Sub清除选区单字节空格()WithSelection.Find.Text=.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub5、'清除选区单字节空格Sub清除选区2单字节空格()WithSelection.Find.Text=.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub6、'清除选区1字空格Sub清除选区1字空格()WithSelection.Find.Text=.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub7、'清除选区段首2字空格Sub清除选区段首2字空格()WithSelection.Find.Text=.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub8、'清除选区TabSub清除选区Tab()WithSelection.Find.Text=vbTab.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub9、'增加选区空格Sub增加选区空格()WithSelection.Find.Text=.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub10、'选区段首缩进0字Sub选区段首无缩进()WithSelection.Find.Text=.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.ParagraphFormat.LeftIndent=CentimetersToPoints(0)'左缩进0字符.RightIndent=CentimetersToPoints(0)'右缩进0字符.FirstLineIndent=CentimetersToPoints(0)'首行缩进点0公分.CharacterUnitLeftIndent=0'左缩进单位0字符.CharacterUnitRightIndent=0'右缩进单位0字符.CharacterUnitFirstLineIndent=0EndWithWithSelection.ParagraphFormat.LeftIndent=CentimetersToPoints(0)'左缩进1字符.RightIndent=CentimetersToPoints(0)'右缩进2字符.FirstLineIndent=CentimetersToPoints(0)'首行缩进点0.35公分.CharacterUnitLeftIndent=0'左缩进单位0字符.CharacterUnitRightIndent=0'右缩进单位0字符.CharacterUnitFirstLineIndent=0EndWithEndSub11、'选区段首缩进:2字Sub选区段首缩进2字()WithSelection.ParagraphFormat.LeftIndent=CentimetersToPoints(0)'左缩进1字符.RightIndent=CentimetersToPoints(0)'右缩进2字符.FirstLineIndent=CentimetersToPoints(0.35)'首行缩进点单位公分.CharacterUnitLeftIndent=0'左缩进单位0字符.CharacterUnitRightIndent=0'右缩进单位0字符.CharacterUnitFirstLineIndent=2EndWithEndSub12、'选区段首缩进转空格—已完美Sub选区段首缩进转空格()Selection.InsertParagraphBeforeCall选区段首无缩进WithSelection.Find.Text=^p.Replacement.Text=^p.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllSelection.DeleteWithSelection.Find.Text=^p.Replacement.Text=.MatchWildcards=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllEndSub13、'选区段后间距1行Sub选区段后间距1行()Selection.ParagraphFormat.FirstLineIndent=CentimetersToPoints(0)Selection.ParagraphFormat.LineUnitAfter=1EndSub14、'选区段后间距1行Sub选区段前段后间距半行()Selection.ParagraphFormat.FirstLineIndent=CentimetersTo
本文标题:Word宏代码集锦
链接地址:https://www.777doc.com/doc-4343931 .html