Set AppWord = CreateObject("Word.Application")
AppWord.Visible = True
SetParent AppWord, Frame1.hWnd
SetParent函数的第一个参数要求是句柄hwnd,可是用createobject函数返回的是一个对象,我用这个对象名来作为setparent函数的第一个参数,可是却提示类型不匹配?请问,我该怎么得到appword这个对象的句柄?
AppWord.Visible = True
SetParent AppWord, Frame1.hWnd
SetParent函数的第一个参数要求是句柄hwnd,可是用createobject函数返回的是一个对象,我用这个对象名来作为setparent函数的第一个参数,可是却提示类型不匹配?请问,我该怎么得到appword这个对象的句柄?
Private Sub Command3_Click()
Dim hwd As Long
Set AppWord = CreateObject("Word.Application")
DoEvents
hwd = FindWindow(vbNullString, AppWord.Caption)
SetParent hwd, Frame1.hWnd
AppWord.Visible = True
MsgBox "ok"
End Sub
结帖!