我的机器配置和你一样,我的程序部分代码如下:运行到WinWnd = FindWindow("OpusApp", "")时返回值总是0.但是我已经有文档打开了。
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_Load()
Dim App As Word.Application
Dim doc As Word.Document
Dim wdModule As Object
Dim i As Integer
Dim existed As Boolean
Dim Founded As Boolean
Dim WinWnd As Variant
WinWnd = FindWindow("OpusApp", "")
If WinWnd = 0 Then 'Word没有运行
Set App = New Word.Application
Set doc = App.Documents.Add
Else 'Word已经被运行
Set App = GetObject(, "Word.Application") '将Word赋给对象变量
End If
[此贴子已经被作者于2002-4-8 14:52:33编辑过] |