c++ word automation, open document, ignore errors

R

Roel

Hi,

I'm automating Word from C++. I use #import to get COM wrappers for
the Office OM. I open my document like this:

m_WordApplication->Documents->Open(&filename, &false_, &false_,
&false_);

(m_WordApplication is a Word::_ApplicationPtr).

The 'false' parameters are to prevent dialogs from showing when
somethine is wrong. In most cases, this code runs fine. However, when
I try to open a document that was open when Word crashed before, I get
a dialog asking me if I want to recover the document or not. I need to
run this code on a server, and need to prevent at all costs that
dialogs of any kind ever show up. I'd much rather have the document
open fail and give me a way to detect that. Is this possible? If so,
how? Thanks.

cheers,

roel
 
C

Cindy M.

Hi Roel,

Are you familiar with the content of this KB article

http://support.microsoft.com/kb/257757/en-us

The Office applications, generally, do not provide any way to completely
suppress dialog boxes, especially those dealing with security and file
integrity. Best you can do in some cases is the approach outlined here

http://support.microsoft.com/kb/307292
I'm automating Word from C++. I use #import to get COM wrappers for
the Office OM. I open my document like this:

m_WordApplication->Documents->Open(&filename, &false_, &false_,
&false_);

(m_WordApplication is a Word::_ApplicationPtr).

The 'false' parameters are to prevent dialogs from showing when
somethine is wrong. In most cases, this code runs fine. However, when
I try to open a document that was open when Word crashed before, I get
a dialog asking me if I want to recover the document or not. I need to
run this code on a server, and need to prevent at all costs that
dialogs of any kind ever show up. I'd much rather have the document
open fail and give me a way to detect that. Is this possible?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
R

Roel

Hello Cindy,

I wasn't aware of those, thank you very much for those links - doesn't
look good for me, I'll have to find another solution I'm afraid.

cheers,

roel
 

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