VBç¼ç¨ä¸ç¨UTF-8ç¼ç ç¼åçææ¬æ件ï¼é½ä¼äº§çä¸ä¸ªBOMï¼è¿ä½¿å¾è½¬æ¢åºæ¥çæ件ï¼å¨ç³»ç»ç¼è¯ä¸ç¼è¯ä¸è¿å»ï¼å¿
é¡»è¦æBOMå»æï¼éè¿ä»£ç å®ç°å¦ä¸ï¼
Dim app As Excel.Application
Dim eworkbook As Workbook
Dim eworksheet As Worksheet
Dim eworksheet_count As Integer
Dim sheetName As String
Dim obj As Object
Dim FileNum
Dim file_path as String
Dim j as Integer
Dim filepath_save as String
filepath_save = "D:/"
Set app = New Excel.Application //è¿æ¥EXCEL
Set eworkbook = app.Workbooks.Open(file_path)
eworkbook_count = eworkbook.Worksheets.count
For j = 1 To eworkbook_count
filepath_path = filepath_save & j & ".txt"
Set eworksheet = eworkbook.Sheets(j)
sheetName = eworksheet.Name
Set obj = New ADODB.Stream //设置ADODBæµ
With obj
.Open
.Charset = "UTF-8"
.Position = .Size
.WriteText "helloworld", 1
.SaveToFile filepath_save
.Close
End With
Set obj = Nothing
Open filepath_save For Input As #1 //æ¶é¤UTF-8çBOM
Line Input #1, str
mm = Replace(str, str, "msgid """"")
Close #1
Open filepath_save For Binary As #FileNum
Put #FileNum, , mm
Close #FileNum
Next j
Set eworksheet = Nothing
eworkbook.Close
Set eworkbook = Nothing
app.Quit
Set app = Nothing