7.3 Getting a handle on the application

Getting a handle on the application

To open Excel with Automation, use the following command (type along in the Command Window, if you want to):

oExcel = CreateObject("Excel.Application")

Nothing happens! Check the task manager; Excel is up and running, but it s just not visible. Like the other Office applications, Excel is hidden when it s instantiated through Automation, and it s up to you to tell it when to become visible. This is a powerful feature automating Excel without having to update the screen can shave 10 percent to 30 percent off your run time! When you re ready to show Excel to your users, set the Application s Visible property:

oExcel.Visible = .T.

If you re following along in FoxPro s Command Window, you ll see that Excel is visible, but there s no spreadsheet; just a gray screen. When the user starts Excel interactively, it s assumed that the user wants to jump right into a blank worksheet and begin typing. Automation does not assume anything! You have total control.

All of the Excel examples assume that you ve already created an Excel server object, accessed by a variable called oExcel.

 

Copyright 2000 by Tamar E. Granor and Della Martin All Rights Reserved



Microsoft Office Automation with Visual FoxPro
Microsoft Office Automation with Visual FoxPro
ISBN: 0965509303
EAN: 2147483647
Year: 2000
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net