If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to forcibly kill the word session?
Hi,
We have a VB program which opens word documents and data source and performs mailmerge programmatically. Whenever there is a problem with mailmerge (eg: some mergefields are missing) the word session hangs. Can you please tell me a method wherein i can forcible kill the word session. I tried calling the Quit method on WordApplication object and close method on the word docs which are open. Both the statements hang as word itself has hanged. How do i forcible kill the word session programmatically .... Any help would be greatly appreciated. Thanks & Regards, Veena. |
#2
|
|||
|
|||
How to forcibly kill the word session?
If you can find a way to forcibly kill Word using vba that is also hung, and
then manage to deal with all the problems created by orphaned temporary files that crashing Word will leave behind and the possibility that autorecover may or may not be active on the target machine, then that would be a nifty piece of programming. I would have thought a better approach would have been to error trap the problems that are likely to occur so that it doesn't hang in the first place. I suggest posting the errant part of the code in one of the vba newsgroups with a request for how best to error trap that aspect of it. -- Graham Mayor - Word MVP Web site www.gmayor.com Word MVP web site www.mvps.org/word Veena wrote: Hi, We have a VB program which opens word documents and data source and performs mailmerge programmatically. Whenever there is a problem with mailmerge (eg: some mergefields are missing) the word session hangs. Can you please tell me a method wherein i can forcible kill the word session. I tried calling the Quit method on WordApplication object and close method on the word docs which are open. Both the statements hang as word itself has hanged. How do i forcible kill the word session programmatically .... Any help would be greatly appreciated. Thanks & Regards, Veena. |
#3
|
|||
|
|||
How to forcibly kill the word session?
Thank you for the suggestion Graham !!!
But, actually we are trying to cater to the generic scenario when word hangs. In a normal scenario ,after doing a mailmerge (programmatically), the merged output document is produced and the subsequent mail merges go through fine. But, in some cases, the mail merge fails, eg,it pop-ups some dialogs, like "Record and header delimiter" or "invalid merge field". These dialogs require manual intervention but, programmatically it is difficult to supress these dialogs, the reason being there are multiple scenarios or worse still the WORD session itself is hidden. Thus, i need a generic solution wherein, if the word hangs or is in a inconsistent state, i can forcibly kill it, open a fresh session again and continue the mailmerges. Please advice!! Thanks & Regards, Veena. "Graham Mayor" wrote in message ... If you can find a way to forcibly kill Word using vba that is also hung, and then manage to deal with all the problems created by orphaned temporary files that crashing Word will leave behind and the possibility that autorecover may or may not be active on the target machine, then that would be a nifty piece of programming. I would have thought a better approach would have been to error trap the problems that are likely to occur so that it doesn't hang in the first place. I suggest posting the errant part of the code in one of the vba newsgroups with a request for how best to error trap that aspect of it. -- Graham Mayor - Word MVP Web site www.gmayor.com Word MVP web site www.mvps.org/word Veena wrote: Hi, We have a VB program which opens word documents and data source and performs mailmerge programmatically. Whenever there is a problem with mailmerge (eg: some mergefields are missing) the word session hangs. Can you please tell me a method wherein i can forcible kill the word session. I tried calling the Quit method on WordApplication object and close method on the word docs which are open. Both the statements hang as word itself has hanged. How do i forcible kill the word session programmatically .... Any help would be greatly appreciated. Thanks & Regards, Veena. |
#4
|
|||
|
|||
How to forcibly kill the word session?
Take a look at vba help for 'On Error Statement' which should cover your
requirements. -- Graham Mayor - Word MVP Web site www.gmayor.com Word MVP web site www.mvps.org/word Veena wrote: Thank you for the suggestion Graham !!! But, actually we are trying to cater to the generic scenario when word hangs. In a normal scenario ,after doing a mailmerge (programmatically), the merged output document is produced and the subsequent mail merges go through fine. But, in some cases, the mail merge fails, eg,it pop-ups some dialogs, like "Record and header delimiter" or "invalid merge field". These dialogs require manual intervention but, programmatically it is difficult to supress these dialogs, the reason being there are multiple scenarios or worse still the WORD session itself is hidden. Thus, i need a generic solution wherein, if the word hangs or is in a inconsistent state, i can forcibly kill it, open a fresh session again and continue the mailmerges. Please advice!! Thanks & Regards, Veena. "Graham Mayor" wrote in message ... If you can find a way to forcibly kill Word using vba that is also hung, and then manage to deal with all the problems created by orphaned temporary files that crashing Word will leave behind and the possibility that autorecover may or may not be active on the target machine, then that would be a nifty piece of programming. I would have thought a better approach would have been to error trap the problems that are likely to occur so that it doesn't hang in the first place. I suggest posting the errant part of the code in one of the vba newsgroups with a request for how best to error trap that aspect of it. -- Graham Mayor - Word MVP Web site www.gmayor.com Word MVP web site www.mvps.org/word Veena wrote: Hi, We have a VB program which opens word documents and data source and performs mailmerge programmatically. Whenever there is a problem with mailmerge (eg: some mergefields are missing) the word session hangs. Can you please tell me a method wherein i can forcible kill the word session. I tried calling the Quit method on WordApplication object and close method on the word docs which are open. Both the statements hang as word itself has hanged. How do i forcible kill the word session programmatically .... Any help would be greatly appreciated. Thanks & Regards, Veena. |
Thread Tools | |
Display Modes | |
|
|