ロックアップの原因となる更新されたスクリプトを使用しています...(Replace:= wdReplaceOne)を(Replace:= wdReplaceAll)に置き換えようとしましたが、それでもそのような運はありません:
Option Explicit
'Dim strMacroName As String
Dim spellingcorrectionsrep As Long
Public Sub SpellingReview()
Dim oShell, MyDocuments
'MyDocsファイルパスの宣言:Set oShell = CreateObject( "Wscript.Shell")MyDocuments = oShell.SpecialFolders( "MyDocuments")Set oShell = Nothing
' Set values for variables of the actual word to find/replace
spellingsuggestionsrep = 0
spellingcorrectionsrep = 0
' Replacements
SpellingCorrections "dog", "dog (will be changed to cat)", False, True
' END SEARCHING DOCUMENT AND DISPLAY MESSAGE
MsgBox spellingcorrectionsrep
'strMacroName = "Spelling Review"
'Call LogMacroUsage(strMacroName)
End Sub
Sub SpellingCorrections(sInput As String, sReplace As String, MC As Boolean, MW As Boolean)
' Set Selection Search Criteria
Selection.HomeKey Unit:=wdStory
With Selection
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Highlight = True
.Text = sInput
.Replacement.Text = sReplace
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchWildcards = False
.MatchCase = MC
.MatchWholeWord = MW
End With
Do While .Find.Execute = True
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
If .Find.Execute(Replace:=wdReplaceOne) = True Then
spellingcorrectionsrep = spellingcorrectionsrep + 1
End If
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
Loop
End With
End Sub