AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,835
- Office Version
- 2019
- 2016
- Platform
- Windows
I would like to read and write to an Excel worksheet from another app, like Access or VB6.
From Googling I see examples but I can't quite get anything to work.
This will read from Excel but crashes when I try to write/save.
Can anyone help fix this? Thanks.
From Googling I see examples but I can't quite get anything to work.
This will read from Excel but crashes when I try to write/save.
VBA Code:
Dim objExcel As Object, wb As Object
Set objExcel = CreateObject("Excel.Application")
Set wb = objExcel.workbooks.Open("C:\Temp\flacs.xls")
objExcel.Worksheets("Sheet1").Activate
With objExcel
Debug.Print .cells(1, 1)
.cells(1, 1) = "test"
End With
' objExcel.displayalerts = False
' objExcel.Save
' objExcel.quit
Set wb = Nothing
Set objExcel = Nothing