J
Jan Kucera
Hi Cindy, hi all!
Using vbscript, I open a document and a template as a document which I
attach to it using myOpenedDoc.AttachedTemplate = app.Documents.Open(..).
Now, as Cindy explained to me,
I do need to have some way to explicitly UNLOAD (close) the template.
Especially if this is NOT 2003. In earlier versions this was the source of
some really bad memory leaks and other problems.
Well... this code I'm placing in the template:
Private Sub Document_Close()
If ThisDocument = ActiveDocument Then Exit Sub
Dim doc As Document
For Each doc In Documents
If doc.AttachedTemplate = ThisDocument Then Exit Sub
Next doc
ThisDocument.Close False
End Sub
Is this the right way?
Thanks,
Jan
Using vbscript, I open a document and a template as a document which I
attach to it using myOpenedDoc.AttachedTemplate = app.Documents.Open(..).
Now, as Cindy explained to me,
I do need to have some way to explicitly UNLOAD (close) the template.
Especially if this is NOT 2003. In earlier versions this was the source of
some really bad memory leaks and other problems.
However
how can I find when to close it if this is necessary?
Well... this code I'm placing in the template:
Private Sub Document_Close()
If ThisDocument = ActiveDocument Then Exit Sub
Dim doc As Document
For Each doc In Documents
If doc.AttachedTemplate = ThisDocument Then Exit Sub
Next doc
ThisDocument.Close False
End Sub
Is this the right way?
Thanks,
Jan