Visual Basic - Verificar si existe un archivo antes de escribirlo

Life is soft - evento anual de software empresarial
 
Vista:

Verificar si existe un archivo antes de escribirlo

Publicado por Alejandro Padilla (2 intervenciones) el 12/07/2001 07:01:12
Como puedo verificar si un archivo ya existe para preguntar al usuario si desea sobreescribirlo?

Gracias de antemano !! .
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Verificar si existe un archivo antes de escribi

Publicado por Mauricio Baeza (60 intervenciones) el 12/07/2001 07:47:54
Este código funciona, pero si usas el CommonDialog, este control trae una propiedad que te detecta, al guardar, si ya existe el archivo...

If Len(Dir(Ruta_del_archivo))>0 Then
Existe = True
Else
Existe = False
End If
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Verificar si existe un archivo antes de escribi

Publicado por Felmolpa (59 intervenciones) el 12/07/2001 23:35:32
Este codigo tambien funciona, nada mas que no ocupas ningun control, nada mas digitas el codigo y listo.

Dim Objeto As Object

Set Objeto = CreateObject("Scripting.FileSystemObject")
If (Objeto.fileexists(Ruta+Nombre_del_archivo)) Then
Existe = True
Else
Existe = False
End If
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar