0

我想使用 ddmmyyyy_hhmmss.txt & FileFormat:=xlTextMSDOS 将所选工作表的包含导出到 D:\Reports\

    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
4

1 回答 1

0

您的宏中没有任何内容实际上会尝试保存任何内容。这一行:

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

甚至不会编译。

这应该有效:

Sheets("Dummy").SaveAs Filename:="D:\Reports\" & zz & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False
于 2013-10-16T21:30:46.243 回答