This action cannot be completed

M

mjlaali

Hi,
I have created an automation program which opens a word file through MS Word
Object Model and creates a new file using the opened file. When I use it with
large files, it intensively makes calls to Word Object Model Methods and
after doing part of the job a dialog will appear which informs “This action
cannot be completed because the other program is busy. Choose ‘switch to’ to
activate the busy program and correct the problemâ€. If I click ‘switch to’
button of the dialog, Windows start button will act. If I click ‘retry’
button of the dialog it will appear again and if I click ‘cancel’ button of
the dialog my program will catch a COleException whose error message is “Call
was rejected by calleeâ€. I don’t know why it happens and how I should fix it.
thanks,
 
D

Doug Robbins - Word MVP

You would have to show us the code that you are using.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
M

mjlaali

The code is bigger than what could be included here. It is developed in
multiple classes using MFC. But I summarized it below:

Documents docs = m_wordApplication.GetDocuments();

m_document = docs.Open(COleVariant(filePathCStr), COleVariant((short)FALSE),
COleVariant((short) FALSE), COleVariant((short)FALSE), optionalArgument,
optionalArgument, COleVariant((short) FALSE),optionalArgument,
optionalArgument,
optionalArgument, optionalArgument, COleVariant((short) FALSE),
optionalArgument,
optionalArgument, COleVariant((short) TRUE), optionalArgument);


m_listOfParagraphs = m_document.GetParagraphs();
m_listOfSentences = m_document.GetSentences();

/////////////open output doc
CString toBeOpenedFilePath(m_filePath.c_str());

m_outDocument = docs.Open(COleVariant(toBeOpenedFilePath),
COleVariant((short)FALSE),
COleVariant((short) FALSE), COleVariant((short)FALSE), optionalParam,
optionalParam, COleVariant((short) FALSE),optionalParam, optionalParam,
optionalParam, optionalParam, COleVariant((short) FALSE), optionalParam,
optionalParam, COleVariant((short) TRUE), optionalParam);
Range docRange = m_outDocument.Range(optionalParam, optionalParam);

docRange.SetNoProofing(TRUE);
///////////////////////////////
 

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