I asked them to runtask manager and see if excel was amongst the apps running and it wasn't.
Seems there is something in an MDE file which doesn't quite work.
Here is the code that creates the Excel file and inserts a heading into it.
Code: Select all
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, sQ, sPathFn, True
''''DoCmd.TransferSpreadsheet acExport, , sQ, sPathFn, True
Dim objapp As Object
Dim objwb As Object
Dim objsh As Object
Set objapp = CreateObject("Excel.Application")
objapp.Visible = True
Set objwb = objapp.Workbooks.Open(sPathFn)
Set objsh = objwb.Sheets(1)
objsh.Rows(1).Insert
objsh.Cells(1, 1) = sH
objwb.Close SaveChanges:=True
objapp.Quit
Set objsh = Nothing
Set objwb = Nothing
Set objapp = Nothing
''''Application.FollowHyperlink sPathFn
ShellExecute Application.hWndAccessApp, "Open", sPathFn, 0&, 0&, SW_SHOWMAXIMIZED
'''Shell ("excel.exe " & Chr(34) & sPathFn & Chr(34))
'''DoCmd.Close acForm, Me.Name, acSaveNo
Exit_CommandExportExcel_Click:
Exit Sub
Err_CommandExportExcel_Click:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_CommandExportExcel_Click
I will put a msgbox just prior to the ShellExecute command, maybe it's a timing thing.
I will put a msgbox after it as well that shows the err number.
Any other ideas?