I have the attached code below, whic searches for an excel file and then opens the one it finds. However, it opens as a read only file. I need it to open as read-write. Can someone please explain to me what, in the code, is causing the read-only status and how to resolve it?
For Each FoundFile As String In My.Computer.FileSystem.GetFiles(My.Settings.DefFolder, _
' add each found file to the list box
' search each file for the specified string
Dim xlApp As Object = CreateObject("Excel.Application")
Dim xlWB As Object = xlApp.Workbooks.Open(FoundFile)
Dim xlWS As Object = xlWB.Worksheets("Sheet1")
Dim xlFndCell As Object = xlWS.Cells.Find(SearchBox.Text, , -4163, 1)
If Not xlFndCell Is Nothing Then
If xlWS.range("E21").value.ToString = SearchBox.Text Then
FileNm = """" + FoundFile + """"
ProcID = Shell("C:\Program Files\Microsoft Office\Office\excel.exe " & FileNm, AppWinStyle.NormalFocus)
' Activate the application.
*** At this point the Excel file opens as a read-only