Check Other Processes for Excel (Access 2003)

muskilh

Registered User.
Local time
Today, 06:33
Joined
Jun 8, 2009
Messages
14
Hi,

I am using MS Access 2003 an dhaving an issue involving an error when opening a table while MS Excel is open at the same time.
Is there any way to check which processes are open? My solution is to see if Excel is open and if so, a msgbox comes up asking the user to close Excel.

A better solution would be to figure out why exactly Excel is causing a problem. The error occurs when the user is using the Access DB on his computer, which has a table connected to an Excel file on a server. If any instances of Excel are open and the user tries to open this table (or rather the form which uses the table), an error occurs.
I believe this error only occurs on some computers but not all.
If anyone has any insight on this issue, it would be greatly appreciated.


Thanks,
Muskilh
 
This is to do with share violations You cannot have both the Excel file and the linked workbook both open at the same time. If you make any changes to the Excel file if thows errors to the linked instance.

If you really want to close all instances of Excel - even the excel files that do not have anything to do with your access app - without saving - then use

KillProcess("Excel.Exe")

David
 
Thank you for your input. I was planning on using KillProcess("Excel.Exe") as a last resort.
Is there any way to check if Excel is open so the user has the option to save his files?
 
Well for a quick and dirty check you could use something like

On Error Resume Next
Dim XL As Object
Set XL = GetObject(, "Excel.Application")
If Not XL Is Nothing Then
MsgBox "Excel is open"
Else
MsgBox "Excel is closed"
End If
Set XL = Nothing
 
DJkarl,

The code works great.

DCrake

>This is to do with share violations You cannot have both the Excel file and the linked >workbook both open at the same time. If you make any changes to the Excel file if >thows errors to the linked instance.

The link to the Excel file only reads data. If Excel is not open everything works fine. Once Excel is open when the linked Excel file is read it actually opens up on the user's screen causing all kinds of havoc. Suprisingly this only happens when the linked Excel file is stored on the server. If it is stored locally none of these issues happen.

Thanks for your input.

Muskilh and I are working on this problem together.
 

Users who are viewing this thread

Back
Top Bottom