![如何更改 PowerPoint 演示文稿中所有幻灯片的默认语言?](https://linux22.com/image/1359780/%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9%20PowerPoint%20%E6%BC%94%E7%A4%BA%E6%96%87%E7%A8%BF%E4%B8%AD%E6%89%80%E6%9C%89%E5%B9%BB%E7%81%AF%E7%89%87%E7%9A%84%E9%BB%98%E8%AE%A4%E8%AF%AD%E8%A8%80%EF%BC%9F.png)
我尝试了相关讨论但无法更改 PowerPoint 2007 演示文稿所有幻灯片中所有文本的校对语言。
这可能是特征PowerPoint 2007?
以下 VBA“怪物”完成了这项工作,但我正在寻找一种不需要 VBA 的更简单的方法。有什么想法吗?
Option Explicit
Private Sub btnGerman_Click()
Call LanguageChange(msoLanguageIDGerman)
End Sub
Private Sub btnEnglish_Click()
Call LanguageChange(msoLanguageIDEnglishUK)
End Sub
Public Sub LanguageChange(LanguageID As Integer)
Dim sld As Slide
Dim shp As Shape
Dim cnt As Integer
Dim cntAll As Integer
On Error GoTo ErrHandler
Me.btnEnglish.Enabled = False
Me.btnGerman.Enabled = False
cntAll = ActivePresentation.Slides.Count
cnt = 0
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame Then
shp.TextFrame.TextRange.LanguageID = LanguageID
Else
ShapeLanguageChange shp, LanguageID
End If
Next
cnt = cnt + 1
o cnt & " / " & cntAll
Next
Me.btnEnglish.Enabled = True
Me.btnGerman.Enabled = True
Exit Sub
ErrHandler:
MsgBox "Ooops! " & Err.Description, vbCritical, "Error!"
Err.Clear
Me.btnEnglish.Enabled = True
Me.btnGerman.Enabled = True
End Sub
Private Sub o(s As String)
Me.Label1.Caption = s
DoEvents
End Sub
Private Sub ShapeLanguageChange(sh As Shape, LanguageID As Integer)
Dim sha As Shape
If sh.Type = msoGroup Then
For Each sha In sh.GroupItems
If sha.Type = msoGroup Then
ShapeLanguageChange sha, LanguageID
ElseIf sha.HasTextFrame Then
sha.TextFrame.TextRange.LanguageID = LanguageID
End If
Next
End If
End Sub
答案1
不使用 VBA 就无法做到这一点。下面的链接中有很多 VBA 代码,例如您已经在使用递归,这对于导航组至关重要。其他更完整的代码片段还处理幻灯片母版、注释等。