excel中内容要如何转换为文本文件??
Sub 生成文本文件()
Dim rng As Range, k As Range, fs As Object, a As Object
Set rng = Application。InputBox("请选择要转换的数据区域——", "Selection", Type:=8)
If Not rng Is Nothing Then
Set fs = CreateObject("Scripting。 FileSystemObject")
Set a = fs。Createtextfile(ThisWorkbook。Path & "\" & Format(Now, "yyyymmddHHMMS...全部
Sub 生成文本文件()
Dim rng As Range, k As Range, fs As Object, a As Object
Set rng = Application。InputBox("请选择要转换的数据区域——", "Selection", Type:=8)
If Not rng Is Nothing Then
Set fs = CreateObject("Scripting。
FileSystemObject")
Set a = fs。Createtextfile(ThisWorkbook。Path & "\" & Format(Now, "yyyymmddHHMMSS") & "。
txt", True)
For Each k In rng
a。writeline ("DELETE PART CLASS '" & k & "'")
a。writeline ("CREATE PART_CLASS '" & k & "' DISPLAY ''")
a。
writeline ("SET PART_CLASS '" & k & "' color to $White" & vbCrLf)
Next
a。
Close
Set a = Nothing
Set fs = Nothing
End If
Set k = Nothing
Set rng = Nothing
MsgBox "文本文件已经成功生成!"
End Sub。收起