When I click text1, readwritetest.xls then open readwritetest.xls (read only) cell A1 has not changed. After exiting VB readwritetest.xls remains as read only.

VB Code:
  1. Private Sub cmdOpenWorkSheet_Click()
  2. Dim xls As Excel.Application
  3. Dim xlBook As Excel.Workbook
  4. Set xls = New Excel.Application
  5. Set xlBook = xls.Workbooks.Open(App.Path & "\readwritetest.xls")
  6. xlBook.Sheets("sheets").Cells(1, 1) = Me.Text1
  7. End Sub
  8.  
  9. Private Sub Text1_Click()
  10. Call cmdOpenWorkSheet_Click
  11. End Sub