Word Vba修改页边距.纸张纵向.装定线等的代码

时间:2023-12-13 17:46:20 

下面的WAPP是事先定义的word文档工程变量。

以下代码为通过VBA代码来页面的页边距、纸张纵向、装定线、页眉页静等。

WApp.ActiveDocument.PageSetup.LineNumbering.Active =0;//行编号

WApp.ActiveDocument.PageSetup.Orientation =Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait;//页面方向

WApp.ActiveDocument.PageSetup.TopMargin =WApp.CentimetersToPoints(float.Parse("2.54"));//上页边距

WApp.ActiveDocument.PageSetup.BottomMargin = WApp.CentimetersToPoints(float.Parse("2.54"));//下页边距

WApp.ActiveDocument.PageSetup.LeftMargin = WApp.CentimetersToPoints(float.Parse("3.17"));//左页边距

WApp.ActiveDocument.PageSetup.RightMargin = WApp.CentimetersToPoints(float.Parse("3.17"));//右页边距

WApp.ActiveDocument.PageSetup.Gutter = WApp.CentimetersToPoints(float.Parse("0"));//装订线位置

WApp.ActiveDocument.PageSetup.HeaderDistance = WApp.CentimetersToPoints(float.Parse("1.5"));//页眉

WApp.ActiveDocument.PageSetup.FooterDistance = WApp.CentimetersToPoints(float.Parse("1.75"));//页脚

WApp.ActiveDocument.PageSetup.PageWidth = WApp.CentimetersToPoints(float.Parse("21"));//纸张宽度

WApp.ActiveDocument.PageSetup.PageHeight = WApp.CentimetersToPoints(float.Parse("29.7"));//纸张高度

WApp.ActiveDocument.PageSetup.FirstPageTray = Microsoft.Office.Interop.Word.WdPaperTray.wdPrinterDefaultBin;//纸张来源

WApp.ActiveDocument.PageSetup.OtherPagesTray = Microsoft.Office.Interop.Word.WdPaperTray.wdPrinterDefaultBin;//纸张来源

WApp.ActiveDocument.PageSetup.SectionStart = Microsoft.Office.Interop.Word.WdSectionStart.wdSectionNewPage;//节的起始位置:新建页

WApp.ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter = 0;//页眉页脚-奇偶页不同

WApp.ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = 0;//页眉页脚-首页不同

WApp.ActiveDocument.PageSetup.VerticalAlignment = Microsoft.Office.Interop.Word.WdVerticalAlignment.wdAlignVerticalTop;//页面垂直对齐方式

WApp.ActiveDocument.PageSetup.SuppressEndnotes =0;//不隐藏尾注

WApp.ActiveDocument.PageSetup.MirrorMargins = 0;//不设置首页的内外边距

WApp.ActiveDocument.PageSetup.TwoPagesOnOne = false;//不双面打印

WApp.ActiveDocument.PageSetup.BookFoldPrinting =false;//不设置手动双面正面打印

WApp.ActiveDocument.PageSetup.BookFoldRevPrinting =false;//不设置手动双面背面打印

WApp.ActiveDocument.PageSetup.BookFoldPrintingSheets = 1;//打印默认份数

WApp.ActiveDocument.PageSetup.GutterPos = Microsoft.Office.Interop.Word.WdGutterStyle.wdGutterPosLeft;//装订线位于左侧

WApp.ActiveDocument.PageSetup.LinesPage = 40;//默认页行数量

WApp.ActiveDocument.PageSetup.LayoutMode = Microsoft.Office.Interop.Word.WdLayoutMode.wdLayoutModeLineGrid;//版式模式为“只指定行网格”

标签:Word,Vba修改页边距.纸张纵向.装定线等的代码
0
投稿

猜你喜欢

  • Mac端这个软件可以帮你找出重复照片:PowerPhotos

    2023-11-25 23:00:54
  • Word中进行设置纸张和文档网格的操作方法

    2023-01-13 04:22:32
  • win10应用商店更新错误0x80073D02该怎么办?

    2022-07-13 02:40:00
  • Win10怎么关闭语音识别功能?Win10关闭语音识别功能的操作方法

    2022-06-22 14:58:35
  • 轻松调整Windows 7任务栏预览窗大小

    2023-10-15 16:28:47
  • 熊猫吃短信如何使用?熊猫吃短信使用方法

    2022-10-13 12:20:19
  • 讯飞输入法快捷短语在哪里

    2022-06-13 00:54:55
  • win10远程控制其他电脑时怎么设置自定义分辨率?

    2022-12-30 16:11:33
  • Win7玩穿越火线老是出现蓝屏怎么办

    2022-12-13 13:56:57
  • WPS excel在数据前面批量添加字母

    2022-07-20 04:06:47
  • 如何翻录 DVD 并将其复制到 Mac?

    2023-06-13 02:38:21
  • Excel中2010版自动填充工作日日期的操作技巧

    2023-08-03 18:39:43
  • 如何截取PDF文档中的部分内容

    2023-06-03 01:45:00
  • excel2003基本操作方法

    2022-01-20 04:07:51
  • Win7系统收藏夹不能用怎么办?Win7系统收藏夹不能用的解决方法

    2022-10-14 17:11:10
  • PPT中怎么制作笔墨效果?

    2023-12-29 14:58:38
  • MacBook如何进入/user目录文件夹?

    2022-06-05 11:16:17
  • word页面高度怎么设置

    2022-11-22 10:45:02
  • Mac新手注意,这2个屏幕锁定方式了解下

    2022-05-16 05:26:37
  • win10截图快捷键保存在哪里?

    2023-10-03 10:11:21
  • asp之家 电脑教程 m.aspxhome.com