我想将所选工作表的包含导出到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
答案 0 :(得分:0)
宏中的任何内容实际上都没有尝试保存任何内容。这一行:
"D:\Reports\" & zz & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False
甚至不会编译。
这应该有效:
Sheets("Dummy").SaveAs Filename:="D:\Reports\" & zz & ".txt", FileFormat:=xlTextMSDOS, CreateBackup:=False