欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

word修改頁邊距/紙張縱向/裝定線等vba代碼

  發(fā)布時間:2013-03-07 10:18:02   作者:佚名   我要評論
本文將介紹一些VBA代碼來實現(xiàn)頁面的頁邊距、紙張縱向、裝定線、頁眉頁靜等,感興趣的你可以參考下,希望這些VBA代碼可以幫助到你
下面的WAPP是事先定義的word文檔工程變量。

以下代碼為通過VBA代碼來實現(xiàn)頁面的頁邊距、紙張縱向、裝定線、頁眉頁靜等。

復(fù)制代碼
代碼如下:

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;//節(jié)的起始位置:新建頁
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;//不設(shè)置首頁的內(nèi)外邊距
WApp.ActiveDocument.PageSetup.TwoPagesOnOne = false;//不雙面打印
WApp.ActiveDocument.PageSetup.BookFoldPrinting =false;//不設(shè)置手動雙面正面打印
WApp.ActiveDocument.PageSetup.BookFoldRevPrinting =false;//不設(shè)置手動雙面背面打印
WApp.ActiveDocument.PageSetup.BookFoldPrintingSheets = 1;//打印默認份數(shù)
WApp.ActiveDocument.PageSetup.GutterPos = Microsoft.Office.Interop.Word.WdGutterStyle.wdGutterPosLeft;//裝訂線位于左側(cè)
WApp.ActiveDocument.PageSetup.LinesPage = 40;//默認頁行數(shù)量
WApp.ActiveDocument.PageSetup.LayoutMode = Microsoft.Office.Interop.Word.WdLayoutMode.wdLayoutModeLineGrid;//版式模式為“只指定行網(wǎng)格”

相關(guān)文章

最新評論