Sub ReplaceChineseCommaInEquations()
Dim rngStory As Range
Dim rngEquation As Range
Dim objEq As OMath
Dim doc As Document
Dim pageIndex As Integer
Dim totalPages As Integer
' Set the active document
Set doc = ActiveDocument
totalPages = doc.ComputeStatistics(wdStatisticPages)
' Loop through each page in the document
For pageIndex = 1 To totalPages
' Select the range of the current page
Set rngStory = doc.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Name:=pageIndex)
rngStory.End = doc.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Name:=pageIndex + 1).Start
rngStory.End = rngStory.End - 1
' Loop through all the equations in the range
For Each objEq In rngStory.OMaths
Set rngEquation = objEq.Range
' Replace Chinese commas with English commas
rngEquation.Text = Replace(rngEquation.Text, ",", ",")
Next objEq
Next pageIndex
MsgBox "Finished replacing Chinese commas with English commas in all equations.", vbInformation
End Sub
替换word中逗号的宏-中文的逗号替换为英文的逗号
于 2024-09-04 01:50:13 首次发布