Hi, I'm struggling with this.
All I want to do is edit an existing excel sheet from access one cell at a time e.g. A1 = "hello".
I've found several code examples for this but none of them seem to work quite right, I'm either left with the excel doc locked to editing, or for some bizarre reason it hides all the sheets inside the file.
This is my current best attempt, if you have any insights I'd really appreciate it it's been driving me nuts for a while now
All I want to do is edit an existing excel sheet from access one cell at a time e.g. A1 = "hello".
I've found several code examples for this but none of them seem to work quite right, I'm either left with the excel doc locked to editing, or for some bizarre reason it hides all the sheets inside the file.
This is my current best attempt, if you have any insights I'd really appreciate it it's been driving me nuts for a while now

Code:
Private Function ExcelTest()
Dim MySheetPath As String
Dim Xl As Excel.Application
Dim XlBook As Excel.Workbook
Dim XlSheet As Excel.Worksheet
MySheetPath = "C:\test\testbook.xlsx"
'Open Excel and the workbook
Set Xl = CreateObject("Excel.Application")
Set XlBook = GetObject(MySheetPath)
Xl.Visible = True
Set XlSheet = XlBook.Worksheets(1)
XlSheet.Visible = xlSheetVisible
XlSheet.Range("A1") = "Hello"
XlBook.Save
Xl.Application.Quit
Set Xl = Nothing
Set XlBook = Nothing
Set XlSheet = Nothing
MsgBox "done"
End Function