I have an instance of each form that I make visible using
the visible property and activate when needed, as you
suggest.
Word is quit and set to nothing each time, and that works
with no problem.
Example:
Public Saving As New frmSaving
Private Sub WordApp_DocumentBeforeClose
Doc.Close()
Saving.Visible = True
Saving.Activate()
WordApp.Application.Quit()
WordApp = Nothing
This works perfectly the first time it is used, then
freezes the second time on the Saving.Visible = True line.
There isn't an obvious reason why. I would be really
grateful for any ideas you can give me.
Thanks
Helen
-----Original Message-----
Are these forms being shown using 'Show' or 'ShowDialog'?
My guess is that when the form are invisible, you are
using Form1.Show...and not Form1.Visible = True, but cannot be sure as you
haven't added anycode in your original post.
If you are using 'Show' & not 'Visible' then you probably
have multipleinstances of the forms.
The other thing it cold be is that you are not destroying
the MS Wordobject. That can be proved by looking for multiple
instances of 'Winword.Exe'in Task Manager
Paste some code for a proper solution though.
"Helen Trim" wrote:
I have an application with three forms that are msde
visible and activated when needed. It uses Word to
open documents and one of the forms is opened as the Word
document is closed in the DocumentBeforeClose event.
It works the first time but when it makes the form visible
for the second time, it freezes. Sometimes it gives an
out of memory error, but I think that may be a red
herring.
Any ideas? Has anyone come across similar problems?
Should I be creating new instances of forms each time
they are needed, rather than having one instance of each and
showing and hiding them?
Thanks
Helen
.