Opening Excel File - Run-time error '462'

TazAdams

Registered User.
Local time
Today, 03:39
Joined
Apr 18, 2007
Messages
14
Hi Guys,

I am having some strange difficulties with trying to open an excel file.

To briefly outline what I'm trying to do; I have numerous queries which I am using as reports, once the user has set the parameters for the query, I run the query and then export it to excel (using this http://www.databasejournal.com/features/msaccess/article.php/3563671) and then finally open excel (using the Application.FollowHyperlink method).

My problem is that it is very tempremental, sometimes it works fine, sometimes it will open excel but just show the toolbars at the top and bottom of excel, but the middle is like 'crashed' I see like an image of my database which is unusable, even though I can still click all the toolbars... so it's not a complete crash.

Other times I get this error:

Run-time error '462':

The Remote server machine does not exist or is unavailabe

And then the following piece of code is highlighted:

Code:
Set appExcel = Excel.Application

I can post more of the code if it will help, but you can always download the excel code from above. Just wondering if anyone has any ideas/suggestions.

Thanks in advance,

Taz
 
As you can see from this article http://support.microsoft.com/default.aspx?kbid=178510, it is probably the other code causing this (un-"anchored" references to Excel objects, properties and/or methods). See if you can fix it yourself by the help of the article, or if not, post relevant part of your automation code.
 
I see now I missed one step.

Set appExcel = Excel.Application

Should be

Set appExcel = New Excel.Application

Sorry, I use

Set appExcel = CreateObject("Excel.Application")

regardless of whether I'm doing early or late binding.
 

Users who are viewing this thread

Back
Top Bottom