How to close Word document in Open event?

A

Anita

Hi all,

I am using Word object model. I am trying to close the document in
Document_Open event of Word applicationObject. Due to this, Word is crashing.

Is there a way by which, we can verify the document opened
by user and close it there (based on some condition)...?

Any pointers on the same would definately help.

Thanks,
~Anita
 
M

Manfred F

Hi Anita,

You want to use an event procedure to perform an action which again triggers
events. I've also tried to do so, but it didn't work, perhaps it can't work:
the first event is still not completely processed, and the application seems
to be not ready there to process Your command.
Your 'close' action must not be in the context of Document_Open. You could
use a timer event and perform it there instead: that should work. Maybe You
want to use the Document_Open to hide the document in the meantime.

Regards,
Manfred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top