M
mjwills
All,
As background to my issue, I have noticed that .Quit in MS Word (97 /
XP) and .Quit in Excel (97 / XP) seem to have quite different
behaviours. In particular, .Quit results in the Word process unloading
from memory, while .Quit in Excel allows Excel to be unloaded from
memory only if there are no references to objects within the Excel
process.
My question is to identify whether *MS has stated that the behaviour I
am seeing (see below) is documented and reliable* (ie will always
happen).
As an example, see the below VB 6 code:
For Word:
Option Explicit
Private app As Word.Application
Private Sub cmdRunWord_Click()
Dim doc As Word.Document
Set app = New Word.Application
Set doc = app.Documents.Add
doc.Application.Visible = True
app.Quit
End Sub
For Excel:
Option Explicit
Private app As Excel.Application
Private Sub cmdExcel_Click()
Dim wks As Excel.Workbook
Set app = New Excel.Application
Set wks = app.Workbooks.Add
wks.Application.Visible = True
app.Quit
End Sub
Private Sub cmdSetToNothing_Click()
Set app = Nothing
End Sub
Note that if you open your Task Manager (to see what processes are
running), you can see when you run the Word code that WINWORD.EXE is no
longer in memory, even though app has not been set to Nothing. But if
you run the Excel code, EXCEL.EXE does not unload from memory until all
objects are Nothing (ie until you click cmdSetToNothing).
The difference in behaviour is significant (I won't go into the
details, but they are related to VB.NET / COM Interop) so I am looking
for an *official MS statement* (a blog entry from a MS staffer would be
fine) that the difference in behaviour between Word and Excel is by
design and particularly that app.Quit can be relied upon to close the
WINWORD.EXE process reliably.
Is anyone aware of such information? Note again that I am not looking
for anecdotal or practical evidence (I have that already) - instead I
am hoping for documentation from MS in some form.
Thanks
Matthew
As background to my issue, I have noticed that .Quit in MS Word (97 /
XP) and .Quit in Excel (97 / XP) seem to have quite different
behaviours. In particular, .Quit results in the Word process unloading
from memory, while .Quit in Excel allows Excel to be unloaded from
memory only if there are no references to objects within the Excel
process.
My question is to identify whether *MS has stated that the behaviour I
am seeing (see below) is documented and reliable* (ie will always
happen).
As an example, see the below VB 6 code:
For Word:
Option Explicit
Private app As Word.Application
Private Sub cmdRunWord_Click()
Dim doc As Word.Document
Set app = New Word.Application
Set doc = app.Documents.Add
doc.Application.Visible = True
app.Quit
End Sub
For Excel:
Option Explicit
Private app As Excel.Application
Private Sub cmdExcel_Click()
Dim wks As Excel.Workbook
Set app = New Excel.Application
Set wks = app.Workbooks.Add
wks.Application.Visible = True
app.Quit
End Sub
Private Sub cmdSetToNothing_Click()
Set app = Nothing
End Sub
Note that if you open your Task Manager (to see what processes are
running), you can see when you run the Word code that WINWORD.EXE is no
longer in memory, even though app has not been set to Nothing. But if
you run the Excel code, EXCEL.EXE does not unload from memory until all
objects are Nothing (ie until you click cmdSetToNothing).
The difference in behaviour is significant (I won't go into the
details, but they are related to VB.NET / COM Interop) so I am looking
for an *official MS statement* (a blog entry from a MS staffer would be
fine) that the difference in behaviour between Word and Excel is by
design and particularly that app.Quit can be relied upon to close the
WINWORD.EXE process reliably.
Is anyone aware of such information? Note again that I am not looking
for anecdotal or practical evidence (I have that already) - instead I
am hoping for documentation from MS in some form.
Thanks
Matthew