> > > > 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
Hi Yuri:
Thank you for your advice, I'll change the code and test it. Here's what I did to close and kill the excel object..
=====================================
IF ISNULL(poExcel)
Release poExcel
poExcel = .NULL.
ELSE
poExcel.Quit
Release poExcel
poExcel = .NULL.
ENDIF
======================================
The question I have is that is this good enough? how would I know sure that I did completely destroyed the instantiated excel object.
Thank you
chieh Z