一张PPT文档里面有汉字和英文。
如“Apple Music,what is your name
你好 吃晚饭”
如何批量把“Apple Music,what is your name”这样的英文内容批量去掉呢?
或者进一步思考,如果VBA如何批量去掉PPT里面的其他类型的文字(繁体字)、法语、数字部分……
以下这一串代码可能对大神在解决这个问题的时候也许能够起到抛砖引玉的作用。感激!
Sub remove_language()
English = "msoLanguageID English"
For Each oSlide In ActivePresentation.Slides
Dim oShape As Shape
For Each oShape In oSlide.Shapes
If oShape.HasTable Then
For r = 1 To oShape.Table.Rows.Count
For c = 1 To oShape.Table.Columns.Count
If oShape.Table.Cell(r, c).Shape.TextFrame.TextRange.LanguageID = English Then
oShape.Table.Cell(r, c).Shape.TextFrame.DeleteText
End If
Next
Next
Else
If oShape.Type = msoGroup Then
If oShape.GroupItems.Count > 0 Then
For i = 1 To oShape.GroupItems.Count
If oShape.GroupItems(i).TextFrame.TextRange.LanguageID = English Then
oShape.GroupItems(i).TextFrame.DeleteText
End If
Next
End If
Else
If oShape.TextFrame.TextRange.LanguageID = English Then
oShape.TextFrame.DeleteText
End If
End If
End If
Next
Next
End sub