[求助]Word嵌入到VB窗体里的问题
我想把一个Word文档嵌入我的vb窗体中,具体要怎么做呢?还要让Word隔一段时间就自己翻页
我自己试了一下,用一个PictureBox控件容器,打开的Word显示在PictureBox里,
在模块用到了两个API函数
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub OpenWord()
'打开Word文档
Dim hWndWordApp As Long
Dim WordObject As Word.Application
Dim WordDocument As Word.Document
Picture1.Visible = True
Set WordObject = CreateObject("Word.application")
WordObject.Visible = True
SetAttr FilePath, vbReadOnly 'FilePath为Word文档的路径
hWndWordApp = FindWindow("OpusApp", "Microsoft Word")
Call SetParent(hWndWordApp, Picture1.hwnd)
Set WordDocument = WordObject.Documents.Open(FilePath)
End Sub
问题:
这样写后在Picture框里可以显示word了,不过我想让打开的word能自动填满picture,请问要怎么做啊?还有就是想让picture框里的word文档在隔一段时间后自动翻页(假设word里有多页的话)