[AccessD] Automation of Excel through Access Problem

Hale, Jim Jim.Hale at FleetPride.com
Tue Jun 15 12:47:36 CDT 2004


Even though it appears you are properly closing excel the fact that your
code doesn't run the second time makes me suspect excel may  still be
running. I have had cases where hidden excel instances do not go away until
access is closed. These instances then cause strange and unnatural things to
happen when the code is executed. Put this vb script in notepad and run it.
It will tell you if you have any extra Excel instances.
Jim Hale

Dim objXL
	Dim strMessage
	
	On Error Resume Next
	
	'	Try to grab a running instance of
	'	Excel...
	Set objXL = GetObject(, "Excel.Application")
	
	'	What did we find?..
	If Not TypeName(objXL) = "Empty" Then
		strMessage = "Excel Running."
	Else
		strMessage = "Excel Not Running."
	End If
	
	'	Feedback to user...
	MsgBox strMessage, vbInformation, "Excel Status"
	
	'	Make the Excel instance visible 
	'	if we found one
	if strMessage = "Excel Running." then _
				objXL.Visible = true 

-----Original Message-----
From: jeffrey.demulling at usbank.com [mailto:jeffrey.demulling at usbank.com]
Sent: Tuesday, June 15, 2004 11:45 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Automation of Excel through Access Problem

Did not work.  I am still getting the same message (which I did not include
in my first post):

Run-time error '1004' Method 'Range' of object '_Global' failed.


                                     ebsite: http://www.databaseadvisors.com



More information about the AccessD mailing list