genere un archivo de ejemplo el cual se llama REGISTRO.TXT
y contiene lo siguiente:
20101004UDDES
20101004UDDES
en donde los 8 primeros caracteres corresponden a la fecha y los restantes a una empresa, todos los registros en este archivo son de largo fijo y los puedo obtener facilmente con un MID y guardarlos en una variable. pero nose como insertar esas variables en un archivo xml
dejo el codigo de lo que llevo.
Código:
Private Sub Command1_Click()
cd.ShowOpen
direccion = cd.FileName
End Sub
Private Sub Command2_Click()
Dim discriminante As String
Dim archivo As String
Dim fecha As String
Dim empresa As String
Dim registro As String
Dim sw As Integer
sw = 0
Open direccion For Input As #1
While Not EOF(1)
Line Input #1, Linea
discriminante = Mid$(Linea, 1, 6)
If discriminante <> "HEADER" And discriminante <> "FOOTER" Then
fecha = Mid$(Linea, 1, 8)
empresa = Mid$(Linea, 21, 5)
sw = 1
End If
If sw = 1 Then
registro = fecha + empresa
EscriveLog registro, "REGISTRO"
sw = 0
End If
Wend
Close #1
archivo = App.Path & "\" & "REGISTRO.txt"
' aki el codigo para convertir el archivo "REGISTRO.TXT" a registro.xml
Response = MsgBox("PROCESO TERMINADO", vbInformation, "empresa x")
End Sub
cd.ShowOpen
direccion = cd.FileName
End Sub
Private Sub Command2_Click()
Dim discriminante As String
Dim archivo As String
Dim fecha As String
Dim empresa As String
Dim registro As String
Dim sw As Integer
sw = 0
Open direccion For Input As #1
While Not EOF(1)
Line Input #1, Linea
discriminante = Mid$(Linea, 1, 6)
If discriminante <> "HEADER" And discriminante <> "FOOTER" Then
fecha = Mid$(Linea, 1, 8)
empresa = Mid$(Linea, 21, 5)
sw = 1
End If
If sw = 1 Then
registro = fecha + empresa
EscriveLog registro, "REGISTRO"
sw = 0
End If
Wend
Close #1
archivo = App.Path & "\" & "REGISTRO.txt"
' aki el codigo para convertir el archivo "REGISTRO.TXT" a registro.xml
Response = MsgBox("PROCESO TERMINADO", vbInformation, "empresa x")
End Sub
Código:
Public Function EscriveLog(ByRef Texto As String, ByRef tipo As String) ', ByRef xTipo As Byte)
Dim strFile As String
Dim fn As Long
Dim strLog As String
strFile = App.Path & "\" & tipo & ".txt"
fn = FreeFile
strLog = Texto
Open strFile For Append As fn
Print #fn, strLog
Close fn
End Function
Dim strFile As String
Dim fn As Long
Dim strLog As String
strFile = App.Path & "\" & tipo & ".txt"
fn = FreeFile
strLog = Texto
Open strFile For Append As fn
Print #fn, strLog
Close fn
End Function
espero me puedan ayudar a crear el XML ya que no tengo idea del formato ni nada por el estilo.
de antemano. GRACIAS!





Autor


En línea





)
como veras es todo estatico y maquillaje 

