Sorry for my incomplete explanation. 
Variable NombreyRutaExport contains the full path + filename and it works fine 
while the file that i want kill not be open by other application. Example:

'-------------------------------------------------------------------------------
dim RutaExport, NombreExport , NombreyRutaExport as string 

NombreExport= "CostraTCM_EXCEL.dbf"
RutaExport =  "C:\Documents and Settings\Samuel\Escritorio\ejercicio de las 
infiltraciones\exportacion a MI\"
NombreyRutaExport =  RutaExport + NombreExport

If  FileExists(NombreyRutaExport) Then 
        OnError GoTo NoSePuede 
        Kill NombreyRutaExport 
End If 

...

NoSePuede:
        note "Error en la exportaci�n a MS Excel"       
        call MAIN
'-----------------------------------------------------------------------------

The problem have been solved using the err() function, see: (it works fine!)

'------------------------------------------------------------------------

dim RutaExport, NombreExport , NombreyRutaExport as string 

NombreExport= "CostraTCM_EXCEL.dbf"
RutaExport =  "C:\Documents and Settings\Samuel\Escritorio\ejercicio de las 
infiltraciones\exportacion a MI\"
NombreyRutaExport =  RutaExport + NombreExport

If  FileExists(NombreyRutaExport) Then 
        OnError GoTo NoSePuede 
        Kill NombreyRutaExport 
End If 

....

NoSePuede:
        if Err() <> 0 then
                note "Error en la exportaci�n a MS Excel. Puede que el archivo 
"+ str$(NombreyRutaExport) + " est� siendo usado por otra aplicaci�n."
        end if
        call MAIN

'--------------------------------

A greeting!





-----Mensaje original-----
De: Terry McDonnell [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 16 de mayo de 2005 10:25
Para: [email protected]
Asunto: RE: MI-L OnError Doubt


We don't know what is stored in your variable NombreyRutaExport.  I believe it 
needs to be the full path + filename of your file.  An example of the code that 
causes the error would be helpful.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 16 May 2005 01:56
To: Terry McDonnell
Subject: MI-L OnError Doubt

I want delete a file, but if the file is open through other program (ej. Excel) 
it give me an error. To solve this problem i try add to my application an 
OnError condition, but it don't work. What i can do??

        If  FileExists(NombreyRutaExport) Then 
                OnError GoTo NoSePuede 
                Kill NombreyRutaExport 
        End If 

...

        NoSePuede:
                note "Error en la exportaci�n a MS Excel"       
                call MAIN


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To 
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16481





---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16483


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16487

Reply via email to