Excel VBA如何新建一个txt文档,并记录一些东西
发布网友
发布时间:2022-04-22 06:36
我来回答
共1个回答
热心网友
时间:2024-03-20 11:06
Sub 另存()
Dim i As Long
Dim str As String
str = "C:\Documents and Settings\Administrator\桌面\"
For i = 1 To UsedRange.Rows.Count
Rows(i).Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=str & ActiveWorkbook.Sheets(1).[a1] & ".txt", FileFormat:= _
xlUnicodeText, CreateBackup:=False '用每行的第一个单元格命名
ActiveWorkbook.Close False
Next i
End Sub