| 网站首页 | 业界新闻 | 群组 | 人才 | 下载频道 | 博客 | 代码贴 | 编程论坛
共有 416 人关注过本帖
标题:想用vb修改word中标题正文的格式,请大神指路
只看楼主 收藏
超级刘小鑫
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-1-19
结帖率:0
  已结贴   问题点数:20  回复次数:2   
想用vb修改word中标题正文的格式,请大神指路
比如说 标题1,小四,黑体,加粗,首行不缩进,段前断后0.5行,页边距全部3厘米
正文,五号,宋体,不加粗,首行2字符,段前断后0.5行,页边距全部3厘米
表格中字体小五,宋体,居中
2018-01-19 10:00
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:85
帖 子:908
专家分:5207
注 册:2015-8-10
  得分:10 
手动操作录制一段宏,然后修改一下不就可以了
2018-01-19 11:23
wds1
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:20
帖 子:212
专家分:1148
注 册:2016-3-10
  得分:10 
楼上方法可行,稍微改一下就行。
下面是我以前做的,请参考
Dim wd As New Word.Application
 Set ap = CreateObject("word.application")
 Set doc = ap.Documents.Add
  wd.Documents.Add DocumentType:=wdNewBlankDocument
  wd.ActiveWindow.ActivePane.View.Zoom.Percentage = 100 '页面显示100%
 With wd.ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientLandscape
        .TopMargin = CentimetersToPoints(1)
        .BottomMargin = CentimetersToPoints(1)
        .LeftMargin = CentimetersToPoints(1)
        .RightMargin = CentimetersToPoints(1)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.5)
        .FooterDistance = CentimetersToPoints(1.75)
        .PageWidth = CentimetersToPoints(29.7)
        .PageHeight = CentimetersToPoints(21)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
        .LayoutMode = wdLayoutModeLineGrid
  End With
2018-01-20 12:24







关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.387416 second(s), 8 queries.
Copyright©2004-2018, BCCN.NET, All Rights Reserved