evault
asked on
Excel opened as 'read only'
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, _
FileIO.SearchOption.SearchAllSubDirectories, "*.xls")
' 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.
AppActivate(ProcID)
*** At this point the Excel file opens as a read-only
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open Excel Read/Write
http://support.microsoft.com/kb/291288
Regards,
Rob.