psbrown
MIS
- Oct 16, 2001
- 40
Hi I have a button on an acess form that runs the code below, this has been happily working on access/excel 2000 for some time. We have just upgraded to access/excel 2003 and it is failing at the code marked ***** Failing Below Here.
I have done the usual searches and cannot find anything, any help/guidance would be much appreciated.
Paul
Private Sub CmdMAccInc_Click()
On Error GoTo ErrorHandler
Dim strCurDir As String
'Find Current Directory
strCurDir = CurrentDb.Name
strCurDir = Left(strCurDir, Len(strCurDir) - Len(Dir(strCurDir)))
MsgBox "here"
MsgBox strCurDir
****** Failing Below Here
'Update spreadsheet with Query Data
DoCmd.TransferSpreadsheet acExport, 8, "qryMOIncident", strCurDir & "\MoIncident.xls", True
'Open Spreadsheet and allow user to ammend and save as required.
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open (strCurDir & "MoIncident.xls")
Exit Sub
ErrorHandler:
MsgBox "Please ensure that you have not already got MoIncident.xls open"
End Sub
I have done the usual searches and cannot find anything, any help/guidance would be much appreciated.
Paul
Private Sub CmdMAccInc_Click()
On Error GoTo ErrorHandler
Dim strCurDir As String
'Find Current Directory
strCurDir = CurrentDb.Name
strCurDir = Left(strCurDir, Len(strCurDir) - Len(Dir(strCurDir)))
MsgBox "here"
MsgBox strCurDir
****** Failing Below Here
'Update spreadsheet with Query Data
DoCmd.TransferSpreadsheet acExport, 8, "qryMOIncident", strCurDir & "\MoIncident.xls", True
'Open Spreadsheet and allow user to ammend and save as required.
Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open (strCurDir & "MoIncident.xls")
Exit Sub
ErrorHandler:
MsgBox "Please ensure that you have not already got MoIncident.xls open"
End Sub