jim may
Well-known Member
- Joined
- Jul 4, 2004
- Messages
- 7,486
If I step thru the entire code (thru the last line shown - even though there is more) and I in the immediate window type in:
appExcel.Workbooks.Open("C:\Users\James\Documents\Trusted_Locations\CBF\LastExport.xlsx")
My Excel File does not have the proper data in it!!!
If I run the query "qryDataExportedToExcel" the correct data is there...
I;m getting VERY frustrated,,, Can someone assist?
TIA,
Jim
appExcel.Workbooks.Open("C:\Users\James\Documents\Trusted_Locations\CBF\LastExport.xlsx")
My Excel File does not have the proper data in it!!!
If I run the query "qryDataExportedToExcel" the correct data is there...
I;m getting VERY frustrated,,, Can someone assist?
TIA,
Jim
Code:
Sub ExportToMyExcel()
Dim appExcel As Object
Dim mySourceBook As Object
Dim myDestinationBook As Object
Dim mySourceSheet As Object
Dim myDestinationSheet As Object
Dim Rng1 As Object
Dim Rng2 As Object
Dim LR As Long
On Error Resume Next
Set appExcel = GetObject(, "Excel.Application")
If Err.Number = 429 Then
Set appExcel = CreateObject("Excel.Application")
End If
On Error GoTo 0
'appExcel.Visible = True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "qryDataExportedToExcel", _
"C:\Users\James\Documents\Trusted_Locations\CBF\LastExport.xlsx", True
..........................