作者:乔山办公网日期:
返回目录:excel表格制作
可以写出来。你先自己写写看
Sub 宏1()
apath = Application.ActiveWorkbook.Path
aname = Application.ActiveWorkbook.Name
ActiveWorkbook.SaveAs Filename:=apath & aname & ".xlsx"
End Sub
Sub PrintText()
Dim myFileName As String
Dim myDataAr() As Variant
Dim myStr As String
Dim i As Integer
On Error Resume Next
myFileName = [e2] & ".txt"
Kill ThisWorkbook.Path & "\" & myFileName
With Sheet1
ReDim myDataAr(1 To 146)
For i = 1 To 146
myDataAr(i) = .Cells(i + 4, 5).Value
Next i
Open ThisWorkbook.Path & "\" & myFileName For Output As #1
For i = 1 To UBound(myDataAr)
myStr = ""
myStr = myStr & CStr(myDataAr(i)) & ","
myStr = Left(myStr, (Len(myStr) - 1))
Print #1, myStr
Next
Close #1
End With
MsgBox "文件保e799bee5baa6e79fa5e98193e58685e5aeb9361存成功!"
End Sub
Sub 另存本表zd为TXTxtu()
Dim FullName As String, Row As Long, RowArr
Application.ScreenUpdating = False
FullName = ThisWorkbook.Path & "\" & ActiveSheet.Name & ".txt"
Open FullName For Output As #1
For Row = 14 To 34
If Range("B" & Row) <> "" Then
With WorksheetFunction
RowArr = .Transpose(.Transpose(Range("B" & Row & ":N" & Row)))
End With
Print #1, Join(RowArr, " ")
End If
Next
Close #1
Application.ScreenUpdating = True
MsgBox "生成内完容毕"
End Sub