类的实例化 word vba

6lilu9 2017-09-13 09:58:23
遇到一个问题,百思不得其解,下面的xlappword与word不是等 同的吗?
那“Word.WdOrientation.wdOrientLandscape”应该等同于“xlappword.WdOrientation.wdOrientLandscape”
同理,
那”xlAppWord.CentimetersToPoints(3.17)“应该等同于”Word.CentimetersToPoints(3.17)“
然而事实上却是不行。
    Dim xlAppWord As New Word.Application

Dim Wrdoc = xlAppWord.Documents.Add()

With Wrdoc.PageSetup
.LineNumbering.Active = False
.Orientation = Word.WdOrientation.wdOrientLandscape
.TopMargin = xlAppWord.CentimetersToPoints(3.17)
.BottomMargin = xlAppWord.CentimetersToPoints(3.17)
.LeftMargin = xlAppWord.CentimetersToPoints(2.54)
.RightMargin = xlAppWord.CentimetersToPoints(2.54)
.Gutter = xlAppWord.CentimetersToPoints(0)
.HeaderDistance = xlAppWord.CentimetersToPoints(1.5)
.FooterDistance = xlAppWord.CentimetersToPoints(1.75)
.PageWidth = xlAppWord.CentimetersToPoints(42)
.PageHeight = xlAppWord.CentimetersToPoints(29.7)
.FirstPageTray = Word.WdPaperTray.wdPrinterDefaultBin
.OtherPagesTray = Word.WdPaperTray.wdPrinterDefaultBin
.SectionStart = Word.WdSectionStart.wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = Word.WdVerticalAlignment.wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = Word.WdGutterStyle.wdGutterPosLeft
.LinesPage = 26
.LayoutMode = Word.WdLayoutMode.wdLayoutModeGrid
End With
...全文
311 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyxcc177109 2017-09-25
  • 打赏
  • 举报
回复
3.17/0.35

16,552

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧