J
Jesper Fjølner
I'm sending some data to Excel, but I'm getting a couple of strange errors
intermittently.
Approximately every other time everything runs without problems and fails
every other time.
I have Access open up Excel with the code below. When I close the Excel
window it seems that "Excel.exe" remains in my task list (ctrl-alt-del).
So I suspect it has something to do with wrongful opening or closing of the
app, but can't locate it.
I'm using:
Dim objExcelApp As Object 'late binding
Dim objExcelDoc As Object 'late binding
Set objExcelApp = CreateObject("excel.application") 'late binding
Set objExcelDoc = objExcelApp.Workbooks.Add
Code usually fails at the first insert into a cell such as:
objExcelDoc.Sheets(1).range("A1").Value = "text"
I end the procedure with:
Set objExcelDoc = Nothing
Set objExcelApp = Nothing
The errors I get are:
Run-time error '462'
The remote server machine does not exist or is unvailable
or
Rune-time error '1004'
Method 'Range' of object '_Global' failed
The error newer occours on the first run, but always on the second and
subsequent.
If I close and reopen the database, it runs again on the first run and fails
on the subsequent.
Even though I terminate Excel.exe via the tasklist, the error doesn't go
away before I restart the database.
Can anyone point me in a direction?
Jesper F
intermittently.
Approximately every other time everything runs without problems and fails
every other time.
I have Access open up Excel with the code below. When I close the Excel
window it seems that "Excel.exe" remains in my task list (ctrl-alt-del).
So I suspect it has something to do with wrongful opening or closing of the
app, but can't locate it.
I'm using:
Dim objExcelApp As Object 'late binding
Dim objExcelDoc As Object 'late binding
Set objExcelApp = CreateObject("excel.application") 'late binding
Set objExcelDoc = objExcelApp.Workbooks.Add
Code usually fails at the first insert into a cell such as:
objExcelDoc.Sheets(1).range("A1").Value = "text"
I end the procedure with:
Set objExcelDoc = Nothing
Set objExcelApp = Nothing
The errors I get are:
Run-time error '462'
The remote server machine does not exist or is unvailable
or
Rune-time error '1004'
Method 'Range' of object '_Global' failed
The error newer occours on the first run, but always on the second and
subsequent.
If I close and reopen the database, it runs again on the first run and fails
on the subsequent.
Even though I terminate Excel.exe via the tasklist, the error doesn't go
away before I restart the database.
Can anyone point me in a direction?
Jesper F