G
Guest
I'm using VB.Net to process information out of a word document. If the document fails a test, I would like to close it and move it to an error folder. However, when I try to do that (see below) it says that another process is using the document. Is there some way to force the move to wait for the doc to close?
Thanks.
Dim wrd As Word.Application = New Word.Application
Dim doc As Word.Document
For Each sFile In Files
strName = CPAPDataPath & sFile.ToString
doc = wrd.Documents.Open(strName)
*** Processing Here ***
If...
*** Processing Here ***
Else
wrd.Quit()
sFile.MoveTo(CPAPErrorPath & sFile.Name.ToString)
End If
Thanks.
Dim wrd As Word.Application = New Word.Application
Dim doc As Word.Document
For Each sFile In Files
strName = CPAPDataPath & sFile.ToString
doc = wrd.Documents.Open(strName)
*** Processing Here ***
If...
*** Processing Here ***
Else
wrd.Quit()
sFile.MoveTo(CPAPErrorPath & sFile.Name.ToString)
End If