What are the common problems when app cannot connect to Excel?

J

Jack

Hello,
I have developed the stand alone application which interacts
with Excel spreadsheet.
It works fine on most Windows and computers, but from time to time I have
message from the user that my app cannot 'find' any opened spreadsheets, but
they are opened.
I wonder, what can cause that? What should I advise user to do?
Reinstalling Excel does not help.
I am using vbasic and Excel automation.
Your comments appreciated,
Jack
 
C

Chip Pearson

You might want to post the relevant portion of the code.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
J

Jack

I do not believe it is my code related.
As I said it works 99% times.
I need to know what causes that 1% failure.
Please see below:
===============
Public WithEvents moExcelApp As Excel.Application


Set moExcelApp = GetObject(, "Excel.Application")
If moExcelApp Is Nothing Then 'when not sheet is opened
Set moExcelApp = CreateObject("Excel.Application")
If moExcelApp Is Nothing Then
Debug.Print "Excel app NOT found!"
ExcelApp = 1: Exit Sub
Else
moExcelApp.EnableEvents = True
End If
End If
 
J

Jack

Anyone else to pitch on that subject?
Anybody had that problem before?
I cannot believe it.
In the last 5 years, I encountered at least about 50 computers where Excel
automation did not work!
Jack
 
T

Tim Williams

Without code it's hard to speculate. Was it always consistent on each
"problem" computer ?
Antivirus SW ? Hidden open instance of Excel ?

Tim
 
T

Tim Williams

Without code it's hard to speculate.  Was it always consistent on each
"problem" computer ?
Antivirus SW ?  Hidden open instance of Excel ?

Tim

To elaborate: if there are >1 instances of Excel open then getobject
returns a reference to a random instance. If your expected
spreadsheet isn't open in that instance then your code may fail.

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top