|
参与一下了。。。
- Sub ykcbf() '//2024.3.20
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- f = p & "epc_send.txt"
- zrr = Split(WorksheetFunction.Trim(ReadUTFText(f)), "^^")
- ReDim brr(1 To UBound(zrr), 1 To 2)
- For i = 0 To UBound(zrr)
- If zrr(i) <> Empty Then
- b = Split(zrr(i))
- m = m + 1
- brr(m, 1) = b(0)
- brr(m, 2) = b(1)
- End If
- Next
- With sh
- .UsedRange.Offset(1).Clear
- .[a1].Resize(1, 2).Interior.Color = 49407
- With .[a2].Resize(m, 2)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter '//列居中
- .VerticalAlignment = xlCenter
- End With
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
- Function ReadUTFText(ByVal fn As String) As String
- With CreateObject("ADODB.Stream")
- .Type = 2
- .Mode = 3
- .Open
- .LoadFromFile fn
- .Charset = "UTF-8"
- .Position = 2
- ReadUTFText = .ReadText
- .Close
- End With
- End Function
复制代码
|
|