Or just set m.loExcel.DisplayAlerts = .f. to turn off it asking anything.

Fred

On Wed, Oct 1, 2014 at 2:36 PM, Richard Kaye <[email protected]> wrote:

> Kill is a bit harsh. Close gracefully is better.. :-)
>
> If the user has no interaction with the Excel object you can just add:
>
> m.loExcel.Quit
>
> when you're done with it. However, if you've made changes to a document
> Excel will ask you if you want to save your changes. To avoid that you will
> want to set this property of the Excel object after it is instantiated:
>
> m.loExcel.ActiveWorkbook.Saved=.T.
>
> Basically this tells Excel the workbook has already been saved so no need
> to prompt the user when the application exits.
>
> The VFP command line and Intellisense are the VFP developer's best
> friends. You can instantiate COM objects and manipulate them until you get
> the syntax right.
>
> I strongly recommend the Hentzenwerke VFP Automation book and not just
> because I count Tamar and Ted (and Whil!) among my VFP friends. (No offense
> to Della who I do not believe I ever met.) Most of what I originally
> learned about COM automation came as a result of using that book. There are
> enough good clear examples in it that it will save you many hours of
> learning curve time.
>
> --
>
> rk
> -----Original Message-----
> From: ProfoxTech [mailto:[email protected]] On Behalf Of
> Rafael Copquin
> Sent: Wednesday, October 01, 2014 5:27 PM
> To: [email protected]
> Subject: Re: Is Excel installed?
>
> Yes you must
>
> I do exactly as Rick suggests:
>
> Use a try-catch to instantiate Excel. If it is an object, kill it
> immediately else show a No excel message If Excel is in the system, then
> run the code to show the Excel sheet instantiating it again this time.
>
> It will work for sure
>
> Rafael Copquin
>
> El 01/10/2014 18:08, Sytze de Boer escribió:
> > Oh dear.
> > So I have to kill Excel immediately after?
> >
> >
> >
> > On Thu, Oct 2, 2014 at 10:07 AM, Richard Kaye <[email protected]>
> wrote:
> >
> >> You're welcome, Sytze. Keep in mind that after the Excel object is
> >> created you will have a running instance of Excel but it won't be
> >> visible by default. You need to keep track of it or you can end up
> >> with a bunch of invisible instances of Excel.
> >>
> >> --
> >>
> >> rk
> >> -----Original Message-----
> >> From: ProfoxTech [mailto:[email protected]] On Behalf Of
> >> Sytze de Boer
> >> Sent: Wednesday, October 01, 2014 5:00 PM
> >> To: [email protected]
> >> Subject: Re: Is Excel installed?
> >>
> >> RK, many thanks
> >>
> >>
> >>
> >> On Thu, Oct 2, 2014 at 8:58 AM, Richard Kaye <[email protected]>
> wrote:
> >>
> >>> Use NEWOBJECT to attempt to create an instance of Excel. If you get
> >>> an object then Excel is installed. Wrap the whole thing in a
> TRY...CATCH.
> >>>
> >>> Untested pseudo-code to get you started
> >>>
> >>> LOCAL m.loExcel AS Excel.Application TRY
> >>>          m.loExcel=NEWOBJECT([Excel.Application])
> >>> CATCH TO m.loError
> >>> * do something here if you want depending on the error FINALLY
> >>>          IF VARTYPE(m.loExcel)<>[O]
> >>>                  MESSAGEBOX([No Excel here!])
> >>>          ELSE
> >>>                  MESSAGEBOX([We have Excel here!])
> >>>                  m.loExcel.Visible=.t.
> >>>          ENDIF
> >>> ENDTRY
> >>>
> >>>
> >>> --
> >>>
> >>> rk
> >>> -----Original Message-----
> >>> From: ProfoxTech [mailto:[email protected]] On Behalf Of
> >> Sytze
> >>> de Boer
> >>> Sent: Wednesday, October 01, 2014 3:48 PM
> >>> To: [email protected]
> >>> Subject: Is Excel installed?
> >>>
> >>> What is the quick way to determine of Excel is installed?
> >>>
> >>> In my system, as an example, clients can turn a number of reports into
> an
> >>> Excel pivot report.
> >>> Of course, a number of them phone me to say there's a bug in the system
> >>> because my system comes up with an OLE error. Excel is not installed
> >>>
> >>> --
> >>> Kind regards,
> >>> Sytze de Boer
> >>>
> >>>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAJCBksoXeK2Rj1VB5c-kxwBgsjNussJ6XJu2YudhOhLcO_RQ=a...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to