I've been READING about exporting Access records to Excel. All I need are 6 fields which will be housed on a form to be moved to a particular sheet in Excel. I took a training class and was able to accomplish this, of course now...it's not working.
Here's what I'm using, any ideas?
Private Sub Command31_Click()
On Error GoTo Err_Command31_Click
Dim X As New Excel.Application
X.Visible = True
X.WORKBOOKS.Open ("Q:\CODE\QUOTE2.XLS")
' X.Worksheets.Select ("Sign-Off Record")
CUSTOMER.SetFocus
X.Range("E5").Activate
ActiveCell.Value = CUSTOMER.Text
DESCRIPTION.SetFocus
X.Range("E8").Activate
ActiveCell.Value = DESCRIPTION.Value
DATEORIG.SetFocus
X.Range("D12").Activate
ActiveCell.Value = DATEORIG.Value
DATETARGET.SetFocus
X.Range("E7").Activate
ActiveCell.Value = DATETARGET.Value
SALES1.SetFocus
X.Range("E12").Activate
ActiveCell.Value = SALES1.Value
ActiveWorkbook.SaveAs ("TEST.XLS")
ActiveWorkbook.Close
X.Quit
Exit_Command31_Click:
Exit Sub
Err_Command31_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command31_Click
Command31.SetFocus
End Sub
Thanks in advance,
MrsTFB
Here's what I'm using, any ideas?
Private Sub Command31_Click()
On Error GoTo Err_Command31_Click
Dim X As New Excel.Application
X.Visible = True
X.WORKBOOKS.Open ("Q:\CODE\QUOTE2.XLS")
' X.Worksheets.Select ("Sign-Off Record")
CUSTOMER.SetFocus
X.Range("E5").Activate
ActiveCell.Value = CUSTOMER.Text
DESCRIPTION.SetFocus
X.Range("E8").Activate
ActiveCell.Value = DESCRIPTION.Value
DATEORIG.SetFocus
X.Range("D12").Activate
ActiveCell.Value = DATEORIG.Value
DATETARGET.SetFocus
X.Range("E7").Activate
ActiveCell.Value = DATETARGET.Value
SALES1.SetFocus
X.Range("E12").Activate
ActiveCell.Value = SALES1.Value
ActiveWorkbook.SaveAs ("TEST.XLS")
ActiveWorkbook.Close
X.Quit
Exit_Command31_Click:
Exit Sub
Err_Command31_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command31_Click
Command31.SetFocus
End Sub
Thanks in advance,
MrsTFB