MM ROy


I am using Visual Foxpro 6.0. How to change the height, width and caption of excel application using with Visual Foxpro.



Re: Control Excel Application

dni


How do you open excel application

You may use WITH ....ENDWITH to modify properties.







Re: Control Excel Application

Naomi Nosonovsky

#DEFINE xlMinimized -4140
#DEFINE xlMaximized -4137

loExcel.WindowState = xlMinimized
loExcel.WindowState = xlMaximized

loExcel.Caption = 'My New caption'

loExcel.Width =

loExcel.Height =






Re: Control Excel Application

MM ROy

Thanks ....
How can I close the excel file if the excel file is open using visual foxpro command.




Re: Control Excel Application

Alex Feldstein

oExcel.Quit





Re: Control Excel Application

Naomi Nosonovsky

loExcel.Quit()

loExcel = null





Re: Control Excel Application

ControlNode

If you are wanting to close the ".xls" file use oExcel.ActiveWorkbook.close(). There are optional parameters you can use to prevent prompting the user to save the XLS if changes were made.

I prefer to close the workbooks before calling quit to prevent prompts asking to save changes, incase a change was made and not already saved.

Also, when you are done with the oExcel object and have issued the oExcel.quit() command, Excel continues to run until you store a new value to oExcel (oExcel = .null.) or release oExcel.






Re: Control Excel Application

Naomi Nosonovsky

Good point. You can also just set DisplayAlerts = .f. to not display alerts or always save changes before closing using Save method.



Re: Control Excel Application

MM ROy

Sir,
When I click a label (in the form) an excel file opened within visual foxpro (version 6.0) form. The commands are below...
loExcel = CREATEOBJECT("Excel.Application")
loExcel.windowstate=1
loExcel.Width=670
loExcel.Height=350
loExcel.left=50
loExcel.top=175
loExcel.APPLICATION.WorkBooks.OPEN(<file>)
loExcel.visible = .t.
loExcel.DisplayAlerts = .F.
Then I click another label (in the form), automatically close the above file and open a new file. How i will create the commands




Re: Control Excel Application

Naomi Nosonovsky

You would need to slightly change your approach. Instead of a local loExcel variable you would need to use form's property oExcel. This way you would be able to control Excel instance everythere within form.

Another approach would be to use Event Handler.





Re: Control Excel Application

MarciaAkins

Naomi Nosonovsky wrote:

Another approach would be to use Event Handler.

This is not an option in VFP version 6 ( which MM Roy has twice stated that this is the version he is using ).

The EVENTHANDLER() function and the IMPLEMENTS keyword of the DEFINE CLASS command were not added to the language until version 7.






Re: Control Excel Application

Naomi Nosonovsky

MarciaAkins wrote:
Naomi Nosonovsky wrote:

Another approach would be to use Event Handler.

This is not an option in VFP version 6 ( which MM Roy has twice stated that this is the version he is using ).

The EVENTHANDLER() function and the IMPLEMENTS keyword of the DEFINE CLASS command were not added to the language until version 7.

Good point. So, only the first approach would be a valid option. Or upgrade Smile





Re: Control Excel Application

MM ROy

Sir, can you explain (step by step)...........




Re: Control Excel Application

Naomi Nosonovsky

What exactly do you want to be explained - using form's reference or EventHandler (the later is much better explained in Marcia's article in her website) http://www.tightlinecomputers.com/Documents/akins_automation.zip