Crear un fihero.txt si no existe y a帽adir a continuaci贸n si existe
Hola. He puesto el siguiente c贸gido:
Dim fs As Object
Dim a As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:HORASEXTRASOT.txt", True)
a.WriteLine ("Esto es una prueba")
a.Close
Esto me funciona bien, pero lo que quer铆a es poder a帽adir a continuaci贸n del contenido del archivo.
Gracias.
Dim fs As Object
Dim a As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:HORASEXTRASOT.txt", True)
a.WriteLine ("Esto es una prueba")
a.Close
Esto me funciona bien, pero lo que quer铆a es poder a帽adir a continuaci贸n del contenido del archivo.
Gracias.
Dim fs as object
set fs = createobject("scripting.filesystemobject")
if fs.fileexists("c:HORASEXTRASOT.txt") Then
Open "c:HORASEXTRASOT.txt" For Append As #1
Else
Open "c:HORASEXTRASOT.txt" For Output As #1
End If
salu2
sdemingo
set fs = createobject("scripting.filesystemobject")
if fs.fileexists("c:HORASEXTRASOT.txt") Then
Open "c:HORASEXTRASOT.txt" For Append As #1
Else
Open "c:HORASEXTRASOT.txt" For Output As #1
End If
salu2
sdemingo
Muchas gracias sdemingo!. Ya lo tengo . Le he puesto el siguiente c贸gigo:
Dim fs As Object
Dim a As Object
Dim empleado As String
Set fs = CreateObject("scripting.filesystemobject")
If fs.fileexists("c:HORASEXTRASOT.txt") Then
MsgBox "EL FICHERO SI QUE EXISTE"
Open "c:HORASEXTRASOT.txt" For Append As #1
empleado = "Prueba"
Print #1, empleado
Close #1
Else
MsgBox "EL FICHERO NO EXISTE"
Open "c:HORASEXTRASOT.txt" For Output As #1
empleado = "Prueba"
Print #1, empleado
Close #1
End If
Dim fs As Object
Dim a As Object
Dim empleado As String
Set fs = CreateObject("scripting.filesystemobject")
If fs.fileexists("c:HORASEXTRASOT.txt") Then
MsgBox "EL FICHERO SI QUE EXISTE"
Open "c:HORASEXTRASOT.txt" For Append As #1
empleado = "Prueba"
Print #1, empleado
Close #1
Else
MsgBox "EL FICHERO NO EXISTE"
Open "c:HORASEXTRASOT.txt" For Output As #1
empleado = "Prueba"
Print #1, empleado
Close #1
End If
