Set ow = CreateObject("word.application")
Set od = ow.documents.open("c:\aa.doc")
ow.Visible = True
od.Close SaveChanges:=wdDoNotSaveChanges
ow.Quit SaveChanges:=wdDoNotSaveChanges
看看:
Dim WithEvents wdApp As Word.Application
Dim WithEvents wdDoc As Word.Document
Private Sub wdApp_DocumentBeforeClose(ByVal Doc As Word.Document, Cancel As Boolean)
If Doc Is wdDoc Then
wdDoc.Close SaveChanges:=wdDoNotSaveChanges
wdApp.Quit SaveChanges:=wdDoNotSaveChanges
Set wdDoc = Nothing
Set wdApp = Nothing
End If
End Sub