Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error message
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01232179
Message ID:
01232242
Views:
14
May be he needs to use TerminateProcess (or something along the lines).

You also can find from the VFP when Excel is closed, if started by automation, using Event handler and Implements. I had some notes on the topic and may try to find older threads.

Additional idea, perhaps using GetObject you can get a reference to the Excel application and Close it using loExcel.Quit.

But I think we need to go with the second approach.

>OK, you can use another trick...
>
>
>CLOSE all
>SET DATE BRITISH
>SET CENTURY on
>thisform.text9.Value=GETFILE('xls')
>
>**************************************************
>   declare long ShellExecute in "shell32.dll" ;
>	long hwnd, string lpszOp, ;
>	string lpszFile, string lpszParams, ;
>    string lpszDir, long nShowCmd
>ShellExecute(0,'Open',thisform.text9.Value,'','',1)
>lihFile=FOPEN(thisform.text9.Value)
>
>DO WHILE lihFile<=0 && yiu can add test to escape key
>   WAIT WINDOW 'Please, change tel. number in XLS Sheet and close XLS Sheet' TIME 1
>   lihFile=FOPEN(thisform.text9.Value)
>ENDDO
>=FCLOSE(lihFile)
>
>********************************************************
>IMPORT FROM (thisform.text9.value) TYPE xls
>*IMPORT FROM (thisform.text2.value) TYPE csv
>
>use JUSTSTEM(thisform.text9.value)
>m.t=JUSTSTEM(thisform.text9.value)
>USE (m.t)
>
>FOR gnCount = 1 TO FCOUNT( )
>   m.OldName =  FIELD(gnCount)
>   m.NewName = ALLTRIM(EVALUATE(FIELD(gnCount)))
>
>
>   *******************************************************
>   ALTER TABLE (m.t) RENAME COLUMN (m.OldName) TO (m.NewName)
>  * ALTER TABLE (thisform.text2.value) RENAME COLUMN (m.OldName) TO (m.NewName)
>NEXT
>=MESSAGEBX("DON")
>*BROWSE
>
>
>
>
>>thank you,
>>Why you don't use OLE? becuse the user need to do that, and telno maybe
>>('C1')or('C2')or('C3')...,
>>i know you can tel the user to rename the filed out of vfp code or form,
>>
>>but i fetch for vfp code if it is possible ,
>>
>>this is the code
>>
>>CLOSE all
>>SET DATE BRITISH
>>SET CENTURY on
>>thisform.text9.Value=GETFILE('xls')
>>
>>**************************************************
>>   declare long ShellExecute in "shell32.dll" ;
>>	long hwnd, string lpszOp, ;
>>	string lpszFile, string lpszParams, ;
>>    string lpszDir, long nShowCmd
>>ShellExecute(0,'Open',thisform.text9.Value,'','',1)
>>
>>
>>********************************************************
>>IMPORT FROM (thisform.text9.value) TYPE xls
>>*IMPORT FROM (thisform.text2.value) TYPE csv
>>
>>use JUSTSTEM(thisform.text9.value)
>>m.t=JUSTSTEM(thisform.text9.value)
>>USE (m.t)
>>
>>FOR gnCount = 1 TO FCOUNT( )
>>   m.OldName =  FIELD(gnCount)
>>   m.NewName = ALLTRIM(EVALUATE(FIELD(gnCount)))
>>
>>
>>   *******************************************************
>>   ALTER TABLE (m.t) RENAME COLUMN (m.OldName) TO (m.NewName)
>>  * ALTER TABLE (thisform.text2.value) RENAME COLUMN (m.OldName) TO (m.NewName)
>>NEXT
>>=MESSAGEBOX("DON")
>>*BROWSE
>>
>>
>>thanks.
>>
>>>Mohammed,
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform