欢迎来到天天文库
浏览记录
ID:51151789
大小:107.00 KB
页数:5页
时间:2020-03-19
《怎么在word中批量删除页眉和页脚.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、怎么在word中批量删除页眉和页脚 在日常工作中,我们有时会碰到一大堆文件需要批量删除页眉与页脚,如果一个个打开文件手工删除的话,会很耗时间精力,下面小编就教你怎么在word中批量删除页眉和页脚. word中批量删除页眉和页脚的步骤: 首先,我先制作一个测试文件夹,里面包含几个word文档,都有页眉--百度经验这四个字,当然其他的文字也行,只是一个测试; 下面我们需要打开宏,03版的宏不需要去开启开发工具,只需要点击菜单栏中的工具-宏-宏; 进入宏对话框,我们可以在宏名随便输入英文字母,在右侧点击一下创建; 接着,进入了宏代码编写框,将下
2、面代码复制进来: Sub批量删除页眉页脚() Application.ScreenUpdating=False DimMyPathAsString,iAsInteger,myDocAsDocument WithApplication.FileDialog(msoFileDialogFolderPicker) .Title="选择要处理目标文件夹"&"——(删除里面所有Word文档的页眉页脚)" If.Show=-1Then MyPath=.SelectedItems(1) Else ExitSub EndIf EndWith
3、WithApplication.FileSearch .LookIn=MyPath .FileType=msoFileTypeWordDocuments If.Execute>0Then Fori=1To.FoundFiles.Count SetmyDoc=Documents.Open(FileName:=.FoundFiles(i)) 'B可以替换的宏 '以下是处理格式所录制的宏,可根据所需录制 IfActiveWindow.View.SplitSpecial<>wdPaneNoneThen ActiveWindow.Panes(
4、2).Close EndIf IfActiveWindow.ActivePane.View.Type=wdNormalViewOrActiveWindow._ ActivePane.View.Type=wdOutlineViewThen ActiveWindow.ActivePane.View.Type=wdPrintView EndIf ActiveWindow.ActivePane.View.SeekView=wdSeekCurrentPageHeader Selection.WholeStory Selection.Delete
5、Unit:=wdCharacter,Count:=1 Selection.WholeStory WithSelection.ParagraphFormat .Borders(wdBorderLeft).LineStyle=wdLineStyleNone .Borders(wdBorderRight).LineStyle=wdLineStyleNone .Borders(wdBorderTop).LineStyle=wdLineStyleNone .Borders(wdBorderBottom).LineStyle=wdLineStyleN
6、one With.Borders .DistanceFromTop=1 .DistanceFromLeft=4 .DistanceFromBottom=1 .DistanceFromRight=4 .Shadow=False EndWith EndWith WithOptions .DefaultBorderLineStyle=wdLineStyleSingle .DefaultBorderLineWidth=wdLineWidth075pt .DefaultBorderColor=wdColorAutomatic EndW
7、ith IfSelection.HeaderFooter.IsHeader=TrueThen ActiveWindow.ActivePane.View.SeekView=wdSeekCurrentPageFooter Else ActiveWindow.ActivePane.View.SeekView=wdSeekCurrentPageHeader EndIf Selection.WholeStory Selection.DeleteUnit:=wdCharacter,Count:=1 ActiveWindow.ActivePane.
8、View.SeekView=wdSeekMainDocument Selection.Sections(1
此文档下载收益归作者所有