VB如何用SendMessage函数向Word2003的文本编辑区发送文本?

用FindWindow和FindWindowEX获取Word窗口的句柄,但是发送文本时Word编辑区无任何显示,没发送成功

Word2003编辑框不是Edit控件,所以不能用FindWindow和FindWindowEX获取Word窗口的句柄来发送文本。你可以用以下办法发送文本:

Private Sub Command1_Click()
Dim i As Long
Dim Word, doc
Set Word = GetObject(, "word.application")
Word.Selection.TypeText Text:="0000"
Set doc = Nothing
Set Word = Nothing
End Sub追问

谢谢,这个程序我还看不懂,你能解释下这几句吗?
Set Word = GetObject(, "word.application")
Word.Selection.TypeText Text:="0000"
Set doc = Nothing
Set Word = Nothing
还有,如果我想往其他程序的文本编辑区发送文本,这个程序能用吗?比如说往Windows的超级终端发送文本

温馨提示:答案为网友推荐,仅供参考
相似回答