|
-
May 14th, 2019, 12:12 PM
#1
Thread Starter
Fanatic Member
Specifying time-out for objects?
Hello!
I'm using the following code to automate Word:
Dim nWord As Object
Set nWord = CreateObject("Word.Application")
nWord.DisplayAlerts = 0 'wdAlertsNone
nWord.Documents.Open (uFile)
nWord.Selection.WholeStory
However, it sometimes happens that the code is stuck at
nWord.Documents.Open (uFile)
The only thing that helps then is to manually kill the Word process in the taskmanager.
How could I define time-out so that VB6 stops trying and I don't have to kill Word in order to make my application working again?
Thank you!
ps: The problem why it would hang was that there was a loading error. Word prompted me this error when I started Word from outside VB6). I was expecting that using the "OpenAndRepair" option would automatically fix this, but it still hung when I used these arguments:
nWord.Documents.Open uFile, False, True, , , , , , , , , , True 'the last argument defines "OpenAndRepair"
Last edited by tmighty2; May 14th, 2019 at 12:56 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|