我尝试了相关讨论但无法更改 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 代码,例如您已经在使用递归,这对于导航组至关重要。其他更完整的代码片段还处理幻灯片母版、注释等。