Hello


I have a macro that creates a txt-file and saves it.

How can I have the macro open that txt-file once it created and saved it ?


Sub ExportToTextFile()
    Dim a       As Variant
    Dim s       As String
    Dim r       As Range
    Dim rng     As Range
    Dim C       As Range
    Dim i       As Long
    Dim k       As Long
    Dim cl      As Long

    ReDim a(1 To 1)
    s = "C:\Dokumente und Einstellungen\Felix\Eigene Dateien\PRODUCTION\"
    cl = 25
    k = 1

    For i = 3 To Cells(Rows.Count, 1).End(xlUp).Row
        If i = 3 Then Set r = Cells(i, 1)

        If Cells(i, 1).Borders(xlEdgeBottom).LineStyle <> xlLineStyleNone Then
            ReDim Preserve a(1 To k)
            a(k) = "c:\(" & Cells(1, cl).Value & ").printer"
            Set rng = Range(r, Cells(i, 1))

            For Each C In rng
                k = k + 1
                ReDim Preserve a(1 To k)
                a(k) = CStr(s & C.Value & ".jpg")
            Next C

            Set r = Cells(i + 1, 1)
            cl = cl + 1: k = k + 1
        End If
    Next i

    ArrayToTextFile a, "C:\Users\User\Documents\Spaces\TD1\" & "\Print.job"

    MsgBox "Done...", 64
End Sub

Thanks !