We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Public Sub Test() Dim FilePath As String = "C:\Change to Your Path\Test Doc.docx" ' Create a new instance of word and open some document in it Dim WordInstance As New Microsoft.Office.Interop.Word.Application Dim Document As Microsoft.Office.Interop.Word.Document = WordInstance.Documents.Open(FilePath) ' Now try to create a readonly stream (to send a copy of our ' changes back to the server) Dim fStream As FileStream = Nothing Try fStream = New FileStream(Me._FilePath, FileMode.Open, FileAccess.Read, FileShare.Read) Catch ex As Exception MessageBox.Show("Error: " & ex.Message) Finally If fStream IsNot Nothing Then fStream.Close() fStream = Nothing End If End Try WordInstance.Quit() End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.