0

I want to export the contains of selected sheet to D:\Reports\ with ddmmyyyy_hhmmss.txt & FileFormat:=xlTextMSDOS

    Sub DummyOut()
    Sheets("Dummy").Activate

    zLastRow = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 1 To zLastRow
    zString = "'"
    zString = zString & Right("000000" & Cells(i, 1), 6)
    zString = zString & Right("000000000" & Cells(i, 2), 9)
    zString = zString & Right("000" & Cells(i, 3), 3)
    zString = zString & Right("0000000000000" & (Cells(i, 4) * 100), 13)
    zString = zString & Right("" & Cells(i, 5), 6)
    Cells(i, 1) = zString
    Next i
    [b:e].Clear

    zz = Format(Now(), "ddmmyyyy_hhmmss")

    "D:\Reports\" & zz & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False

    End Sub
Community
  • 1
  • 1
  • Couple of things: `1` What problems are you facing? `2` [INTERESTING READ](http://stackoverflow.com/questions/10714251/excel-macro-avoiding-using-select) `3` Did you try recording a macro? – Siddharth Rout Oct 16 '13 at 20:33

1 Answers1

0

Nothing in your macro actually attempts to save anything. This line:

"D:\Reports\" & zz & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False

won't even compile.

This should work:

Sheets("Dummy").SaveAs Filename:="D:\Reports\" & zz & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False
barrowc
  • 10,444
  • 1
  • 40
  • 53