- ©«¤l
- 109
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 114
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7 Win10
- ³nÅ骩¥»
- Office 2019 WPS
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ²`¦`
- µù¥U®É¶¡
- 2013-2-2
- ³Ì«áµn¿ý
- 2024-11-6
|
- Sub Test001()
- Dim FileName As String
- Dim hFile As Long
- Dim lngEndRow As Long
- Dim R As Long, C As Long
- Dim bytText() As Byte
- Dim strText As String
- Dim strCrLf As String
-
- R = InStrRev(ThisWorkbook.Name, ".")
- If R > 0 Then
- FileName = Left$(ThisWorkbook.Name, R - 1)
- Else
- FileName = ThisWorkbook.Name
- End If
- strCrLf = Space(21) & vbCrLf
- With Sheet1
- lngEndRow = .Range("A" & .Rows.Count).End(xlUp).Row
- hFile = FreeFile
- Open ThisWorkbook.Path & Application.PathSeparator & FileName & ".TXT" For Binary As hFile
- For R = 1 To lngEndRow
- strText = vbNullString
- For C = 1 To .UsedRange.Columns.Count
- strText = strText & .Cells(R, C).Text
- Next C
- strText = strText & IIf(Len(strText), strCrLf, vbCrLf)
- bytText() = StrConv(strText, vbFromUnicode)
- Put hFile, , bytText()
- Next R
- Close hFile
- End With
- End Sub
½Æ»s¥N½X |
|