Word Crashes when used with Excel and Windows Processes


Joined
Jan 2, 2009
Messages
3
Reaction score
0


Hello All



I have an Excel 2000 workbook that processes a number of Word documents to create a single Word document.



The user creates a list of Word files. A macro then goes through the list of files to create the resulting document.



The outputted file is created by opening a source Word file, copying the content, then pasting the details to the target Word file.



This method of copying and pasting works perfectly when there are know errors in the source file.



Unfortunately, due to some of the floors in Word and the floors in Users, the documents that are going to be combined can become corrupted.



For example when opening a message will appear “This document is corrupt…” the file still works fine once opened, it just shows that message. Another type of corruption is embedded within tables contained within the file. These issues do not stop the file being used, but do cause problems when being copied and pasted.



What is happening is that Excel will open the Word file will correctly. The Copy command will copy the details. When the Paste instruction is called and the Word file crashes and shows the “Word has to close now..” error.



This issues is not something caused by the interaction with Excel or a macro, it happens if you open the two Word documents and go Edit>copy, Edit>Paste.



So my first question is



Is there a better why to combine documents?



I’ve tried the “merge” function, but that didn’t seem to do anything. Word prompts to accept any changes (of which there are none to accept) then stops without doing anything.



Having spent a while investigating this problem I don’t think there is a way (please correct me if I’m wrong) to get around this issue for a corrupted Word file.



My current solution is to validate each file when it is added to the list for processing. To do this I open the file and try to copy and paste the contents. If an error occurs it is caught by the error handler and dealt with.



Here is the next problem. When the paste operation fails it is caught and a message is passed back to the user that the file is corrupt. I then have to gracefully deal with the Word. If I try and close the Word file via Excel the “Word has crashed” message is displayed. This cannot be shown to the users. My next thought was to kill the Word process.



This I can do, but it kills all open instances of Word. I have a macro which will kill a specific instance of Word, but for that I need the Process ID, which currently I do not know how to find from within Excel.



Does anyone know how I can kill a specific Word instance in the task manager when I only know the file name?



Thanks for any help



Christian

 
Ad

Advertisements


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