Вот встроенными инструментами ворд'а
Visual BasicВыделить код |
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Sub SaveToUTF8(sSourceFile As String) Dim MyDoc As Document Dim sTargetFile$, i& If Dir(sSourceFile) = "" Then MsgBox sSourceFile & " not exists": Exit Sub i = InStrRev(sSourceFile, ".") sTargetFile = Left(sSourceFile, i - 1) & "_ToUtf8" & Right(sSourceFile, Len(sSourceFile) - i + 1) Set MyDoc = Documents.Open(FileName:=sSourceFile, ConfirmConversions:=False, AddToRecentFiles:=False, _ Revert:=False, Format:=0, Visible:=False) With MyDoc If .OpenEncoding = 65001 Then MsgBox "This is a UTF8-encoded text file!": .Close: Exit Sub .SaveAs FileName:=sTargetFile, fileformat:=7, Encoding:=65001 .Close End With End Sub
|
|
Добавлено через 3 минуты
Насчет знаков "+", непонятно по какому принципу они удаляются на этом сайте, иногда исчезают, иногда - нет