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: 101390 # Views: 3 # Ratings: 0
Version: Visual FoxPro 9 Category: Microsoft Office Automation
Date: Friday, July 14, 2006 2:48:48 PM         
   



> 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

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