Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Yuri Rubinov
  Where is Yuri Rubinov?
 Philadelphia
 Pennsylvania - United States
 Yuri Rubinov
 To: Chieh Zhong
  Where is Chieh Zhong?
 Montreal
 Canada
 Chieh Zhong
Subject: RE: Excel Object - The Server Threw an Exception
Thread ID: 101350 Message ID: 101414 # Views: 4 # Ratings: 1
Version: Visual FoxPro 9 Category: Microsoft Office Automation
Date: Friday, July 14, 2006 4:28:37 PM         
   



> > > Hi Yuri
> > > >
> > > > Are your exe file and prg/scx files located in the very same directory ?Are you running exe file from the very same location?
> > > I just tested by running the EXe in the same location as I compile my project, it still gives the same error, however when I go into development mode, i.e. Command prompt in the same folder and run the form, it works.
> > >
> > >
> > > > Other than that:
> > > > - check for isnull(poExcel)
> > > When I went into debug mode, the PoExcel is not Null, that's why it
> > > pass through the check.
> > >
> > >
> > > > - if you remove poExcel.Visible = .F., then what happen?
> > > > - any user dialog?
> > > When i comment out this line, the next line failed, and so on. I can
> > > see in the debug watch window that the object poExcel exist but when I click open the + sign, all the property value description say's "Expression could not be evaluated"
> > >
> > > Just a note also, object is being instantiated as a private variable inside the class where the Form calls, and within the class that's where it is calling this function to instantiate excel object. Does this gives you and leads to why?
> > >
> > > Thanks
> > > Chieh Z
> >
> >
> > Chieh,
> >
> > Before running exe look into the Windows Task Manager and remove all Excel hanging/hidden processes if any.
> > What if you try to wait:
> >
> > oExcel=createobject(....
> > wait wind time 10.0 "Wait please..."
> > oExcel.visible=.t.
> >
> > Best Wishes,
> >
> > Yuri Rubinov

>
> Hi Yuri:
>
> Just another note, this function is call multiple times within the two class. i.e.
>
> Form (User input raw excel data files)
> ====
> -> Calls Class A
> ======== (class A then calls this function to instantiate
> the excel object and use the object to load the
> raw excel data file check for column heading,
> worksheet name, if no error, it then closes the
> excel object, reset the poExcel to .Null. and
> proceed to instantiate Class B.
>
> -> Class A then Calls Class B
> =======
> (Class B when instantiated, it calls the same
> function to instantiate the exel object to
> load and process the excel data. This is
> the stage where the error occurs, the firt
> time the function is call in Class A, there
> is no problem. It's the second time, I guess
> it could be the problem where the excel
> object created initially hasn't been fully
> destroyed yet. Could this be the case?
>
>
> Thanks
> chieh Z.



Yes, it could be the problem if the initially created Excel object was expected to be closed and destroyed, but it did not. In this case GETobject() may case the problem.

Actually I would not recommend to use getobject() with Excel. It may cause unpredictable results if, say, user has Excel file open and in use.

It would be better to make sure that the instance of Excel that the program created, does not exist anymore.


Best Wishes,

Yuri Rubinov

ENTIRE THREAD

Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 5:47:42 AM
RE: Excel Object - The Server Threw an Exception Posted by Yuri Rubinov @ 7/14/2006 2:48:48 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 3:19:43 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 3:33:35 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 3:38:26 PM
RE: Excel Object - The Server Threw an Exception Posted by Yuri Rubinov @ 7/14/2006 3:45:22 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 4:08:44 PM
RE: Excel Object - The Server Threw an Exception Posted by Yuri Rubinov @ 7/14/2006 4:21:48 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 4:19:49 PM
RE: Excel Object - The Server Threw an Exception Posted by Yuri Rubinov @ 7/14/2006 4:28:37 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 4:32:38 PM
RE: Excel Object - The Server Threw an Exception Posted by Yuri Rubinov @ 7/14/2006 4:46:08 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 5:01:04 PM
RE: Excel Object - The Server Threw an Exception Posted by Yuri Rubinov @ 7/14/2006 5:16:47 PM
RE: Excel Object - The Server Threw an Exception Posted by Jim Winter @ 7/14/2006 4:47:33 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/14/2006 4:56:06 PM
RE: Excel Object - The Server Threw an Exception Posted by Jim Winter @ 7/14/2006 5:35:43 PM
RE: Excel Object - The Server Threw an Exception Posted by Chieh Zhong @ 7/15/2006 4:06:39 AM