Autor
|
Tema: Problemita path (Leído 1,413 veces)
|
Wii900
Desconectado
Mensajes: 20
|
Bue este problemita me ta rompiendo vastantes las %"·&% 
este es el codigoPrivate Sub Reemplazar_Texto(ByVal El_Archivo As String, _ ByVal La_cadena As String, _ ByVal Nueva_Cadena As String) On Error GoTo errSub Dim F As Integer Dim Contenido As String F = FreeFile Open El_Archivo For Input As F Contenido = Input$(LOF(F), #F) Close #F Contenido = Replace(Contenido, La_cadena, Nueva_Cadena) F = FreeFile Open El_Archivo For Output As F Print #F, Contenido Close #F MsgBox " Listo!!! ", vbInformation Exit Sub 'Error errSub: MsgBox Err.Description, vbCritical Close End Sub Private Sub Command1_Click() If (Text1 = "" Or Text2 = "" Or Text3 = "") Then MsgBox " datos incompletos ", vbCritical Exit Sub End If Call Reemplazar_Texto(Text1, Text2, Text3) End Sub
Bien la idea es la siguiente: El Text1 = "" <-- Es la ruta que esta al archivo Text2 = "" <-- Busca Text3 = "" <-- Reemplaza CommandButton1 <-- Guarda los cambiosPrivate Sub Command1_Click() If (Text1 = "" Or Text2 = "" Or Text3 = "") Then MsgBox " datos incompletos ", vbCritical Exit Sub End If Call Reemplazar_Texto(Text1, Text2, Text3) End Sub
Bue yo quiero que el Text1 Tenga 2 Rutas Que reemplaze en 2 Lugares por ej: C:\Texto.txt y D:\Texto.txt
|
|
|
En línea
|
|
|
|
BlackZeroX
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
split()
separando por comas las rutas c:\aaa.txt,f:\gvjjhgj.dat,d:\hfgjhg.exe msgbox split(datos,",")(0) msgbox split(datos,",")(1) msgbox split(datos,",")(2)
o dim rutas () dim i as integer rutas=split(datos,",") for i=0 to ubound(rutas)-1 msgbox rutas(i) next i
P.D.: estas en un foro no en un chat aprende a escribir mejor.!¡ Bue este problemita me ta rompiendo vastantes las %"·&% 
Bue yo quiero que el Text1 Tenga 2 Rutas Que reemplaze en 2 Lugares por ej: C:\Texto.txt y D:\Texto.txt
Dulces Lunas.
|
|
« Última modificación: 25 Septiembre 2009, 19:34 pm por BlackZeroX »
|
En línea
|
The Dark Shadow is my passion.
|
|
|
Wii900
Desconectado
Mensajes: 20
|
Bue men disculpa xD!!  No me retes jeje..
no entendi muy bien sobre las rutas me re perdi xDD!!
bue lo que ise fue crear otro textbox y un commandbutton el codigo me quedo asiPrivate Sub Reemplazar_Texto(ByVal El_Archivo As String, _ ByVal La_cadena As String, _ ByVal Nueva_Cadena As String) On Error GoTo errSub Dim F As Integer Dim Contenido As String F = FreeFile Open El_Archivo For Input As F Contenido = Input$(LOF(F), #F) Close #F Contenido = Replace(Contenido, La_cadena, Nueva_Cadena) F = FreeFile Open El_Archivo For Output As F Print #F, Contenido Close #F MsgBox " Listo!!! ", vbInformation Exit Sub 'Error errSub: MsgBox Err.Description, vbCritical Close End Sub Private Sub Command1_Click() If (Text1 = "" Or Text2 = "" Or Text3 = "") Then MsgBox " datos incompletos ", vbCritical Exit Sub End If Call Reemplazar_Texto(Text1, Text2, Text3) End Sub Private Sub Command2_Click() If (Text4 = "" Or Text5 = "" Or Text6 = "") Then MsgBox " datos incompletos ", vbCritical Exit Sub End If Call Reemplazar_Texto(Text4, Text5, Text6) End Sub
Pero igual men gracias por responder 
|
|
|
En línea
|
|
|
|
|
|