极好用的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

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功