Sub 工作表转txt文件() Dim p$, sht, s$, fullp$ Application.ScreenUpdating = False p = ThisWorkbook.Path & "\" For Each sht In Worksheets fullp = p & "\" & sht.Name & ".txt" Open fullp For Output As #1 r = sht.[a1].CurrentRegion For i = 1 To UBound(r) For j = 1 To UBound(r, 2) s = IIf(s = "", r(i, j), s & vbTab & r(i, j)) Next Print #1, s s = "" Next Close #1 Next Application.ScreenUpdating = True End Sub |
|