vb 设置word页面 vb控制word输出报告,其中的一页需要将页面设置为横向,请高手大虾们帮助! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ActiveDocument.Orientation = wdOrientLandscape http://download.csdn.net/source/1627134 Word 文档的页面设置中有“应用于”下拉框,可以分开设置。按需要多次设置不同的纸张方向即可。 '先创建WORD对象 Private wordApp As Object 'word.application对象 If wordApp Is Nothing Then Set wordApp = CreateObject(;Word.Application;) If wordApp Is Nothing Then DoPrintToFile.Result = ;启动Word失败; Exit Function End If End If '打开word文档 wordApp.Visible = False wordApp.Documents.Open fileName:=fileName, Revert:=False, ReadOnly:=True wordApp.Documents(fileName).Activate '设置打印属性 With wordApp.ActiveDocument.Styles(wdStyleNormal).Font If .NameFarEast = .NameAscii Then .NameAscii = "" End If .NameFarEast = "" End With With wordApp.ActiveDocument.PageSetup .LineNumbering.Active = False .Orientation = wdOrientLandscape .TopMargin = CentimetersToPoints(3.17) .BottomMargin = CentimetersToPoints(3.17) .LeftMargin = CentimetersToPoints(2.54) .RightMargin = CentimetersToPoints(2.54) .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 = wdLayoutModeDefault End With 请教一个思路如何实现?保存用户在文本框中搜索记录。 如何获得当前目录的上一级目录? TreeView + DataGrid 问题 问一个数学中LOG的计算过程 看看这段程序应该运行几遍? 问两个问题。UP有分! 高分相送400分:谁能给我简述一下一个控件的开发过程及注册到网页应用这个过程? 使用IE内核(webBrower控件)制作浏览器,如何自行设定HTTP_USER_AGENT 如何在sql server中写存储过程? 各位高手,请问:ActiveX.Dll、ActiveX.Exe和一般的Exe这三者之间的区别和各有什么用途? 程序调用数据表的记录的问题 button三个事件的运行优先级
Private wordApp As Object 'word.application对象
If wordApp Is Nothing Then
Set wordApp = CreateObject(;Word.Application;)
If wordApp Is Nothing Then
DoPrintToFile.Result = ;启动Word失败;
Exit Function
End If
End If '打开word文档
wordApp.Visible = False
wordApp.Documents.Open fileName:=fileName, Revert:=False, ReadOnly:=True
wordApp.Documents(fileName).Activate '设置打印属性
With wordApp.ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
With wordApp.ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientLandscape
.TopMargin = CentimetersToPoints(3.17)
.BottomMargin = CentimetersToPoints(3.17)
.LeftMargin = CentimetersToPoints(2.54)
.RightMargin = CentimetersToPoints(2.54)
.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 = wdLayoutModeDefault
End With