> Hi:
>
> I am using VFP9 and MS Office Excel 2000 SP1. In my class, I am calling
> my function OpenExcel.prg (see below) to open Excel object to do excel
> automation stuff. When I ran my form (which calls my class), there is no
> excel error while calling this function, however, when I compile my form into
> exe and run it from app's menu, I get an error "The Server Threw an Exception" in this line "poExcel.Visible = .F."
>
> Any Idea why?
>
> Chieh Zhong
> ==========================================================================
> *
> * OpenExcel.prg
> *
>
> PARAMETERS poExcel
>
> LOCAL llTryCatchErr, llNoError
> llTryCatchErr = .F.
> llNoError = .T.
>
> TRY
> poExcel = GetObject(,[Excel.Application]) && If already exist, get it instead
> CATCH
> poExcel = CreateObject([Excel.Application]) && If not, create it
> ENDTRY
>
> IF VARTYPE(poExcel) = "O"
> poExcel.Visible = .F.
> poExcel.DisplayAlerts = .F.
> ELSE
> && Problem, Excel not instantiated...
> llNoError = .f.
> EndIf
> RETURN llNoError
Are your exe file and prg/scx files located in the very same directory ?Are you running exe file from the very same location?
Other than that:
- check for isnull(poExcel)
- if you remove poExcel.Visible = .F., then what happen?
- any user dialog?
Best Wishes,
Yuri Rubinov