RexesOperator
Registered User.
- Local time
- Today, 16:56
- Joined
- Jul 15, 2006
- Messages
- 604
I guess I should have started a new thread on this to avoid confusion. However it is a continuation of the same topic.

I think I am very close to getting Access to load data from a form into a spreadsheet, but I am missing something.
The code below should load the data in the textbox called NAME into cell B9.
After doing some more research, I have this cobbled together this code for two command buttons - OpenExcelFile and LoadInfo. The first button should open the excel file Q11. It does.
The second button should load the data from the Access form into the worksheet. I am getting a runtime error '424' "Object required".
I think I need to identify the worksheet (Tombstone Data) in the workbook. How do I do that?
Private Sub OpenExcelFile_Click()
On Error GoTo Err_OpenExcelFile_Click
Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("C:\Q11.xls")
objXLApp.Visible = True
objXLApp.UserControl = True
Exit_OpenExcelFile_Click:
Exit Sub
Err_OpenExcelFile_Click:
MsgBox Err.Description
Resume Exit_OpenExcelFile_Click
End Sub
Private Sub LoadInfo_Click()
Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("C:\Q11.xls")
objExcelBook.ActiveSheet.Range("B9") = Me.NAME
End Sub
This is thanks to some code borrowed from Bob Larson in another forum. I found it through Google.
I think I am very close to getting Access to load data from a form into a spreadsheet, but I am missing something.
The code below should load the data in the textbox called NAME into cell B9.
After doing some more research, I have this cobbled together this code for two command buttons - OpenExcelFile and LoadInfo. The first button should open the excel file Q11. It does.
The second button should load the data from the Access form into the worksheet. I am getting a runtime error '424' "Object required".
I think I need to identify the worksheet (Tombstone Data) in the workbook. How do I do that?
Private Sub OpenExcelFile_Click()
On Error GoTo Err_OpenExcelFile_Click
Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("C:\Q11.xls")
objXLApp.Visible = True
objXLApp.UserControl = True
Exit_OpenExcelFile_Click:
Exit Sub
Err_OpenExcelFile_Click:
MsgBox Err.Description
Resume Exit_OpenExcelFile_Click
End Sub
Private Sub LoadInfo_Click()
Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("C:\Q11.xls")
objExcelBook.ActiveSheet.Range("B9") = Me.NAME
End Sub
This is thanks to some code borrowed from Bob Larson in another forum. I found it through Google.
Last edited: