首页 批量设置word文档的页面格式

批量设置word文档的页面格式

举报
开通vip

批量设置word文档的页面格式批量设置word文档的页面格式 word word vba 点一个WORD文件-新建宏.... Sub 批量格式设置() '此代码为指 定文件夹中所有选取的WORD文 件的进行格式设置 Dim MyDialog As FileDialog, vrtSelectedItem As Variant, Doc As Document ' On Error Resume Next '忽略错误 '定义一个文件夹选取对话框 Set MyDialog = Application.FileDialog(msoFile...

批量设置word文档的页面格式
批量设置word文档的页面格式 word word vba 点一个WORD文件-新建宏.... Sub 批量格式设置() '此代码为指 定文件夹中所有选取的WORD文 件的进行格式设置 Dim MyDialog As FileDialog, vrtSelectedItem As Variant, Doc As Document ' On Error Resume Next '忽略错误 '定义一个文件夹选取对话框 Set MyDialog = Application.FileDialog(msoFileD ialogFilePicker) With MyDialog .Filters.Clear '清除所有文件筛选器中的项目 .Filters.Add "所有 WORD 文件", "*.doc", 1 '增加筛选器的项目为所有WORD文件 .AllowMultiSelect = True '允许多项选择 If .Show = -1 Then '确定 Application.ScreenUpdating = False For Each vrtSelectedItem In .SelectedItems '在所有选取 项目中循环 Set Doc = Documents.Open(FileName:=vrtSelectedItem, Visible:=False) With Doc With .PageSetup '进行页面设置 .Orientation = wdOrientPortrait '页面方向为纵向 .TopMargin = CentimetersToPoints(2.2) '上边距为2.2cm .BottomMargin = CentimetersToPoints(2.2) '下边距为2.2cm .LeftMargin = CentimetersToPoints(2.5) '左边距为2.5cm .RightMargin = CentimetersToPoints(2.5) '右边距为2.5com .Gutter = CentimetersToPoints(0) '装订线0cm .HeaderDistance = CentimetersToPoints(1.5) '页眉1.5cm .FooterDistance = CentimetersToPoints(1.75) '页脚1.75cm .PageWidth = CentimetersToPoints(21) '纸张宽21cm .PageHeight = CentimetersToPoints(29.7) '纸张高29.7cm .SectionStart = wdSectionNewPage '节的起始位置:新建页 .OddAndEvenPagesHeaderFoot er = False '不勾选“奇偶页不同” .DifferentFirstPageHeaderFoo ter = False '不勾选“首页不同” .VerticalAlignment = wdAlignVerticalTop '页面垂直对 齐方式为“顶端对齐” .SuppressEndnotes = False '不 隐藏尾注 .MirrorMargins = False '不设置 首页的内外边距 .BookFoldRevPrinting = False '不 设置手动双面打印 .BookFoldPrintingSheets = 1 '默 认打印份数为1 .GutterPos = wdGutterPosLeft ' 装订线位于左侧 .LayoutMode = wdLayoutModeLineGrid '版式模式为“只指定行网格” End With With .Content.ParagraphFormat '段落格式设置 .LeftIndent = CentimetersToPoints(0) '左缩进0cm .RightIndent = CentimetersToPoints(0) '右缩进 0cm .SpaceBefore = 0 '段前间距0cm .SpaceBeforeAuto = False '段前间距不设为“自动” .SpaceAfter = 0 '段后间距0cm .SpaceAfterAuto = False '段后间距不设为“自动” .LineSpacingRule = wdLineSpaceExactly .LineSpacing = 24 '行距24磅 .Alignment = wdAlignParagraphJustify '段落设置为两端对齐 .WidowControl = False '不勾选 “孤行控制” .KeepWithNext = False '不勾选“与下段同页” .KeepTogether = False '不勾选“段中不分页” .PageBreakBefore = False '不勾选“段前同页” .NoLineNumber = False '不勾选“取消行号” .Hyphenation = True '不勾选“允许西文在单词中间换行” .FirstLineIndent = CentimetersToPoints(0) '首行缩进0cm .OutlineLevel = wdOutlineLevelBodyText ' 大纲 专科护士培训大纲语法等级大纲网络小说大纲模版专职安全员生产检查释经讲道讲章大纲 级别为“正文文本” .CharacterUnitLeftIndent = 0 '段落左缩进0cm .CharacterUnitRightIndent = 0 '段落右缩进0cm .CharacterUnitFirstLineIndent = 0 '特殊格式为“无” .LineUnitBefore = 0 '段前间距为 0 .LineUnitAfter = 0 '段后间距为 0 .AutoAdjustRightIndent = True '自动调整段落的右缩进 .DisableLineHeightGrid = False '勾选“如果定义了文档网格~则对 齐网格”~即指定段落中的字符与 行网格对齐 .FarEastLineBreakControl = True '将东亚语言文字的换行规 则应用于指定的段落 .WordWrap = True '在指定段落 或文本框的西文单词中间断字换 行 .HangingPunctuation = True '指 定段落中的标点将可以溢出边界 .HalfWidthPunctuationOnTopO fLine = False .AddSpaceBetweenFarEastAnd Alpha = True '自动在指定段落的 中文文字和拉丁文字之间添加空 格。 .AddSpaceBetweenFarEastAnd Digit = True '自动在指定段落中 的中文文字与数字之间添加空格 .BaseLineAlignment = wdBaselineAlignAuto '自动调整 基线字体对齐方式 End With ''''''''''新增部分 With .Content With .Font .NameFarEast = "宋体" .NameAscii = "Times New Roman" .Size = 12 End With With .Paragraphs.First .Range.Font.Size = 16 .Alignment = wdAlignParagraphCenter End With End With .Close True End With Next Application.ScreenUpdating = True End If End With MsgBox "格式化文档操作设置完 毕!", vbInformation End Sub
本文档为【批量设置word文档的页面格式】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_105949
暂无简介~
格式:doc
大小:20KB
软件:Word
页数:6
分类:生活休闲
上传时间:2018-07-21
浏览量:71