您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 国内外标准规范 > 极好用的OFFICE WORD排版使用宏命令
极好用的OFFICEWORD排版使用宏命令我们常常在编写自己的文档时,需要从网上或别的途径获取电子文档资料,这些资料往往都含有大量的不规范的空格,空行和全角数字,增加了文档的排版工作。下面是我使用的宏命令:具体功能是:1、去除段落前后的全角和半角空格;2、去除多余的空行;3、转换数字和字母的全角为半角。Sub排版1()''排版1宏''Selection.Find.ClearFormattingSelection.Find.Replacement.ClearFormattingWithSelection.Find.Text=^p.Replacement.Text=^p.Forward=True.Wrap=wdFindContinue.Format=False.MatchCase=False.MatchWholeWord=False.MatchByte=True.MatchWildcards=False.MatchSoundsLike=False.MatchAllWordForms=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p.Replacement.Text=^p.Forward=True.Wrap=wdFindContinue.Format=False.MatchCase=False.MatchWholeWord=False.MatchByte=True.MatchWildcards=False.MatchSoundsLike=False.MatchAllWordForms=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=^p.Replacement.Text=^p.Forward=True.Wrap=wdFindContinue.Format=False.MatchCase=False.MatchWholeWord=False.MatchByte=True.MatchWildcards=False.MatchSoundsLike=False.MatchAllWordForms=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ClearFormattingSelection.Find.Replacement.ClearFormattingWithSelection.Find.Text=^p^p.Replacement.Text=^p.Forward=True.Wrap=wdFindContinue.Format=False.MatchCase=False.MatchWholeWord=False.MatchByte=True.MatchWildcards=False.MatchSoundsLike=False.MatchAllWordForms=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllWithSelection.Find.Text=~.Replacement.Text=~.Forward=True.Wrap=wdFindContinue.Format=False.MatchCase=False.MatchWholeWord=False.MatchByte=True.MatchWildcards=False.MatchSoundsLike=False.MatchAllWordForms=FalseEndWithSelection.Find.ExecuteReplace:=wdReplaceAllSelection.Find.ExecuteReplace:=wdReplaceAllSelection.WholeStoryDimqjsz,bjszAsString,iAsInteger'定义qjsz(全角数字)、bjsz(半角数字)为字符串型,i为整数型qjsz=0123456789.%ABCDEFGHIJKLMNOPQRSTUVWXYZbjsz=0123456789.%ABCDEFGHIJKLMNOPQRSTUVWXYZFori=1To38'循环38次WithSelection.Find.Text=Mid(qjsz,i,1)'mid函数:返回文本字符串中从指定位置开始的特定数目的字符,每次取一个数字.Replacement.Text=Mid(bjsz,i,1)'将用于替换的相应位置的半角数字.Format=False'保留替换前的字符格式.ExecuteReplace:=wdReplaceAll'用半角数字替换全角数字EndWithNextiEndSub
本文标题:极好用的OFFICE WORD排版使用宏命令
链接地址:https://www.777doc.com/doc-4551493 .html