Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error message
Message
De
12/06/2007 09:40:50
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01232179
Message ID:
01232254
Vues:
16
hi,
thank you so much ,
i need to close myexcel sheet before import it,
via simple code. if it is possible
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  
thanks
>Hi Mohammed,
>
>If you want to follow my second idea (and I don't have a ready code for you), you need to start from Re: Prevent Save in Word? Thread #1198988 Message #1205251 and read the article referenced there.
>
>I believe using this approach you would be able to detect when Excel is closed. I'm not 100% certain, though, but it would be good path to explore, in my opinion.
>
>
>>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,
>>>
>>>Why you don't use OLE?
>>>
>>>loExcel=CreateObject("Excel.Application")
>>>loFile=loExcel.Workbooks.Open(lcFile)
>>>* replace any cell
>>>loFile.Range('C1').Value='tel number'
>>>loFile.Save()
>>>loFile.Close()
>>>loExcel.Quit()
>>>
>>>
>>>MartinaJ
>>>
>>>>thank you for reply,
>>>>i need to open it just to rename one filed from any name to telno,
>>>>
>>>>how i can close it ,to import it after rename(via vfp code),
>>>>
>>>>i mean before
>>>>IMPORT FROM (thisform.text9.value) TYPE xls
>>>>
>>>>thanks.
>>>>
>>>>>Hi Mohammed,
>>>>>
>>>>>You cannot import from XLS sheet if openned.
>>>>>MartinaJ
>>>>>
>>>>>>hi all,
>>>>>>i try to convert excel sheet to dbf via this code...
>>>>>>i got erorr message OLE error code 0x80030020:ashare violation hase occurred.
>>>>>>
>>>>>>thanks for help
>>>>>>
>>>>>>
>>>>>>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 &&&erorr message
>>>>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform