P
Phillip
Hi,
I am starting the Word application in Visual Basic.
I want my Visual Basic routine to be called when the user
closes the document in Word.
I am expecting that when the user closes test.doc then the
routine myword_close should be run.
But it does not work!
Please tell me how I should proceed.
Thanks in advance for any help.
Phillip
===========================================================
============
Public mydoc As Document
Public myword As Word.Application
Sub start_editor()
' Start word
On Error GoTo wordprob
Set myword = CreateObject("Word.Application")
If myword Is Nothing Then
MsgBox "Could not start word"
Exit Sub
End If
On Error GoTo 0
' Open the document
Set mydoc = myword.Documents.Open("c:\TEMP\TEST.DOC")
myword.Visible = True
Exit Sub
wordprob:
MsgBox "Could not start Word " & Err.Description
Exit Sub
End Sub
'
' --- Event handler for Close
'
Sub myword_Close()
MsgBox "Close called"
End Sub
I am starting the Word application in Visual Basic.
I want my Visual Basic routine to be called when the user
closes the document in Word.
I am expecting that when the user closes test.doc then the
routine myword_close should be run.
But it does not work!
Please tell me how I should proceed.
Thanks in advance for any help.
Phillip
===========================================================
============
Public mydoc As Document
Public myword As Word.Application
Sub start_editor()
' Start word
On Error GoTo wordprob
Set myword = CreateObject("Word.Application")
If myword Is Nothing Then
MsgBox "Could not start word"
Exit Sub
End If
On Error GoTo 0
' Open the document
Set mydoc = myword.Documents.Open("c:\TEMP\TEST.DOC")
myword.Visible = True
Exit Sub
wordprob:
MsgBox "Could not start Word " & Err.Description
Exit Sub
End Sub
'
' --- Event handler for Close
'
Sub myword_Close()
MsgBox "Close called"
End Sub