RexesOperator
Registered User.
- Local time
- Today, 08:20
- Joined
- Jul 15, 2006
- Messages
- 604
Please bare with me on this. I am usinging Access 2003. I apoligize for asking this again but ..
I did this right once before but I had to redesign the form. Somehow this has got messed up. I am using the syntax I have seen in Bob Larson's post on this.
I am using a command button (cmdUpLoadQEtoExcel) on the main form to load an excel spreadsheet. The text boxes I need to load are on a subform on a tab page. The main form is frmTransactionsMain. The subform name is frmQeSites and the control "container" is ctlQeSites. I want to load txtSITENAME into cell "B9".
ATM I have:
Private Sub cmdUpLoadQEtoExcel_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
objXLBook.ActiveSheet.Range("B9") = Forms!frmTransactionsMain.ctlQeSites.Form.txtSITENAME
Exit_OpenExcelFile_Click:
Exit Sub
Err_OpenExcelFile_Click:
MsgBox Err.Description
Resume Exit_OpenExcelFile_Click
End Sub
The excel file opens correctly - with no data. I'm getting an "Application not definer or object not defined error"
I did this right once before but I had to redesign the form. Somehow this has got messed up. I am using the syntax I have seen in Bob Larson's post on this.
I am using a command button (cmdUpLoadQEtoExcel) on the main form to load an excel spreadsheet. The text boxes I need to load are on a subform on a tab page. The main form is frmTransactionsMain. The subform name is frmQeSites and the control "container" is ctlQeSites. I want to load txtSITENAME into cell "B9".
ATM I have:
Private Sub cmdUpLoadQEtoExcel_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
objXLBook.ActiveSheet.Range("B9") = Forms!frmTransactionsMain.ctlQeSites.Form.txtSITENAME
Exit_OpenExcelFile_Click:
Exit Sub
Err_OpenExcelFile_Click:
MsgBox Err.Description
Resume Exit_OpenExcelFile_Click
End Sub
The excel file opens correctly - with no data. I'm getting an "Application not definer or object not defined error"