Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15015

Closing Generated MS Word Doc causes error 'Call was rejected by callee'

$
0
0
Short intro - this is a Winform program which can generate MS Word reports.
An error is created when a user trys to shut down the generating word report before the processing is complete (ie if its a long document and the user closes word)

Code:

System.Runtime.InteropServices.COMException
  HResult=0x80010001
  Message=Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

Is there a way to prevent this error or process msword in the background so the user cant interact with it until its finished?

Code:

Dim oWord As Word.Application
        oWord = New Word.Application
        oWord.Documents.Add("\List.dot")
        oWord.Visible = True
        oWord.Activate

        With oWord.ActiveDocument

' do word stuff

        End With
        oWord = Nothing


Viewing all articles
Browse latest Browse all 15015

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>