weird, hard to find Excel-automation error
- From: "Jesper Fjølner" <askfor@xxxxxxxxxxx>
- Date: Mon, 5 Dec 2005 23:11:24 +0100
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
.
- Follow-Ups:
- Re: weird, hard to find Excel-automation error
- From: Ken Snell \(MVP\)
- Re: weird, hard to find Excel-automation error
- From: Douglas J. Steele
- RE: weird, hard to find Excel-automation error
- From: Klatuu
- Re: weird, hard to find Excel-automation error
- Prev by Date: RE: Split an array field
- Next by Date: Re: Open a text file for reading (Off Topic)
- Previous by thread: Re: How to get Autonumber key thru code
- Next by thread: RE: weird, hard to find Excel-automation error
- Index(es):