|
ppt随心所欲朗读文本之VBA代码
下面这两个小程序,第一个没有问题,第二个有BUG,求大侠和行家指教。代码如下:
lide1中代码
Private Sub CommandButton1_Click()
依次朗读
End Sub
Private Sub CommandButton2_Click()
逐屏朗读
End Sub
模块1
Sub 依次朗读()
For i = 1 To ActivePresentation.Slides.Count
Set yy = CreateObject("sapi.spvoice")
Set myDocument = ActivePresentation.Slides(i)
For Each s In myDocument.Shapes
If s.HasTextFrame Then
With s.TextFrame
yy.Speak .TextRange.Text
'Excel.Application.Speech.Speak .TextRange.Text
End With
End If
Next
Next
End Sub
模块2
Sub 逐屏朗读()
Set yy = CreateObject("sapi.spvoice")
With ActivePresentation.SlideShowSettings
.ShowType = ppShowTypeSpeaker
.ShowWithNarration = msoTrue
.ShowWithAnimation = msoTrue
.RangeType = ppShowAll
.AdvanceMode = ppSlideShowUseSlideTimings
.PointerColor.SchemeColor = ppForeground
.Run
End With
For i = 1 To ActivePresentation.Slides.Count
Set myDocument = ActivePresentation.Slides(i)
For Each s In myDocument.Shapes
If s.HasTextFrame Then
With s.TextFrame
yy.Speak .TextRange.Text
End With
End If
|
评分
-
1
查看全部评分
-
|