'打开word的操作 Public oWordApp As Object Public oWordres As Object Dim WithEvents oWordEvents As Word.ApplicationPrivate Sub OpenWordFile(filename As String)
If filename = "" Then Exit Sub End If
Set oWordApp = CreateObject("Word.Application") If Not oWordApp Is Nothing Then If oWordEvents Is Nothing Then Set oWordEvents = oWordApp 'Word.Application End If Set oWordres = oWordApp.Documents.Open(filename, , , False) If Not oWordres Is Nothing Then
oWordApp.Visible = True 'bringToTop ("Microsoft Word") glPid = Shell(appexepath, vbHide) bringToTop ("KeyBoard") Else MsgBox "Could not open the word.", vbCritical End If Else MsgBox "Could not instantiate word.", vbCritical End If deleteMinMaxButton Exit Sub
Public oWordApp As Object
Public oWordres As Object
Dim WithEvents oWordEvents As Word.ApplicationPrivate Sub OpenWordFile(filename As String)
If filename = "" Then
Exit Sub
End If
Set oWordApp = CreateObject("Word.Application")
If Not oWordApp Is Nothing Then
If oWordEvents Is Nothing Then
Set oWordEvents = oWordApp 'Word.Application
End If
Set oWordres = oWordApp.Documents.Open(filename, , , False)
If Not oWordres Is Nothing Then
oWordApp.Visible = True
'bringToTop ("Microsoft Word")
glPid = Shell(appexepath, vbHide)
bringToTop ("KeyBoard")
Else
MsgBox "Could not open the word.", vbCritical
End If
Else
MsgBox "Could not instantiate word.", vbCritical
End If
deleteMinMaxButton
Exit Sub
openwordend:
MsgBox "File not find!" & Chr(13) & "Please consult administrator! " & Err.Description
End SubPrivate Sub oWordEvents_Quit()
cmdKill
oWordApp.Quit
Set oWordApp = Nothing
Set oWordres = Nothing
Set oWordEvents = Nothing
End Sub