狗忠诚的故事落泪的:vb6.0 ole 如何显示word文档(多页)?
来源:百度文库 编辑:高校问答 时间:2024/05/06 10:32:06
在ole容器,打开一个多页的word文档,我加了滚动条,但是只会显示一页,请问如何显示后面的页数?
Private wordtemps As New Word.Application
Private Sub Form_Load()
tempfilename = "d:\200641915421.doc"
wordtemps.Documents.Open FileName:=tempfilename, ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
'wordtemps.Application.ActiveDocument.PageSetup.PageHeight = CentimetersToPoints(55)
'tempfilename = App.Path & "/ico/2006419153253.doc"
OLE1.CreateEmbed (tempfilename)
wordtemps.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Picture1.Visible = True
Picture1.ScaleMode = 1
OLE1.SizeMode = 2 '设定ole自动调整大小,建议在设计阶段就设好
OLE1.Refresh '如此,这两行可以省下不用写
OLE1.Left = 0
OLE1.Top = 0
VScroll1.Max = OLE1.Height - Picture1.ScaleHeight
VScroll1.Min = 0
VScroll1.LargeChange = OLE1.Height \ 20
VScroll1.SmallChange = OLE1.Height \ 100
End Sub
'滚动条拉动时运行
Private Sub VScroll1_Change()
OLE1.Top = -1 * VScroll1.Value
End Sub
Private wordtemps As New Word.Application
Private Sub Form_Load()
tempfilename = "d:\200641915421.doc"
wordtemps.Documents.Open FileName:=tempfilename, ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
'wordtemps.Application.ActiveDocument.PageSetup.PageHeight = CentimetersToPoints(55)
'tempfilename = App.Path & "/ico/2006419153253.doc"
OLE1.CreateEmbed (tempfilename)
wordtemps.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Picture1.Visible = True
Picture1.ScaleMode = 1
OLE1.SizeMode = 2 '设定ole自动调整大小,建议在设计阶段就设好
OLE1.Refresh '如此,这两行可以省下不用写
OLE1.Left = 0
OLE1.Top = 0
VScroll1.Max = OLE1.Height - Picture1.ScaleHeight
VScroll1.Min = 0
VScroll1.LargeChange = OLE1.Height \ 20
VScroll1.SmallChange = OLE1.Height \ 100
End Sub
'滚动条拉动时运行
Private Sub VScroll1_Change()
OLE1.Top = -1 * VScroll1.Value
End Sub