Created
February 16, 2017 10:29
-
-
Save kolipass/e5381a45894ffd01437d3bf8d30730b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub updateFormulsTextSyle() | |
On Error Resume Next | |
Dim F As Word.Field | |
Dim N1 As Long, N2 As Long | |
Application.ScreenUpdating = False | |
N1 = 0: N2 = 0: N3 = ActiveDocument.Fields.Count | |
percent = "" | |
For Each F In ActiveDocument.Fields | |
If F.Type <> Word.wdFieldEmbed Then | |
ElseIf Not (F.OLEFormat.ClassType Like "Equation.*") Then | |
Else | |
N1 = N1 + 1 | |
Err.Clear | |
F.OLEFormat.ConvertTo ClassType:=F.OLEFormat.ClassType | |
If Err.Number <> 0 Then ' ошибка | |
N2 = N2 + 1 | |
Application.ScreenUpdating = True | |
F.Select | |
Select Case MsgBox(Prompt:="Ошибка! " & vbLf & vbLf & _ | |
"Нет возможности обработать формулу типа: " & vbLf & _ | |
F.OLEFormat.ClassType & vbLf & vbLf & _ | |
"Продолжить?", _ | |
Buttons:=VBA.vbCritical + VBA.vbYesNo) | |
Case VBA.vbOK, VBA.vbYes | |
Case Else: Exit For | |
End Select | |
Application.ScreenUpdating = False | |
End If | |
End If | |
tempP = Format(N1 / N3 * 100, "0") | |
If Not percent = tempP Then | |
percent = tempP | |
StatusBar = "Обработано: " & percent & "%" | |
End If | |
Next F | |
Application.ScreenUpdating = True | |
StatusBar = "Обработано формул: " & N1 & ", ошибок: " & N2 | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment