Extraer datos remesa xml a excel

Para Dante

Quiero traer datos de una remesa xml a excel el nombre, importe, domicilio, cuenta banco

1 respuesta

Respuesta
1

Envíame ejemplos de xml y un excel con los datos de esos xml

Mi correo [email protected]

En el asunto del correo escribe tu nombre de usuario “san lo

¡Gracias! por todo Dante

La macro

Sub Extraer_Datos()
'
'Por.Dante Amor
    '
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Set l1 = ThisWorkbook
    Set h1 = l1.Sheets(1)
    h1.UsedRange.Offset(1, 0).ClearContents
    '
    datos = Array("Cdtr/Nm", _
                  "PstlAdr/AdrLine", _
                  "Id/IBAN", _
                  "Amt/InstdAmt")
    ruta = l1.Path & "\"
    arch = Dir(ruta & "*.xml")
    Do While arch <> ""
        k = 1
        Set l2 = Workbooks.Open(Filename:=ruta & arch)
        Set h2 = l2.Sheets(1)
        u1 = h1.Cells(Rows.Count, 1).End(xlUp).Row + 1
        For i = LBound(datos) To UBound(datos)
            Set b = h2.Rows(2).Find(datos(i), lookat:=xlPart)
            If Not b Is Nothing Then
                u2 = h2.Cells(Rows.Count, b.Column).End(xlUp).Row
                h2.Range(h2.Cells(3, b.Column), h2.Cells(u2, b.Column)).Copy _
                    h1.Cells(u1, k)
                k = k + 1
            End If
        Next
        l2.Close
        arch = Dir()
    Loop
    h1.Cells.EntireColumn.AutoFit
    Application.ScreenUpdating = True
    MsgBox "  Extracción de datos....100%  "
End Sub

s2

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas