|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 beleqing 于 2024-9-16 19:12 编辑
大家好,我现在创建了一段代码,用于在每一页PPT中插入和标题栏文字相同的音频文件,请问怎么提取PPT每一页标题栏的文字?我的每一页PPT的标题栏文字格式和位置完全相同。谢谢!
就是代码第16行里的word = "have"里面的"have"提取如何用代码实现?
- Option Explicit
- Sub SampleTest()
- Dim a, b As Integer
- Dim pptName As String
- Dim pageNo As String
- Dim word As String
- Const med_dir As String = "C:\Users\Xu Tingting\Desktop\New folder\The Graham Norton Show S22E15\Vocab"
- pptName = ActivePresentation.Name
- pageNo = Left(pptName, 4)
- For b = 1 To 3
- word = "have"
- Call InsertAudio(med_dir & pageNo & "_" & word & ".mp3", ActivePresentation.Slides(b))
- Next b
- End Sub
- Sub InsertAudio(Track As String, oSlide As Slide)
- Dim oShp As Shape
- Dim oEffect As Effect
- 'Add the audio shape
- Set oShp = oSlide.Shapes.AddMediaObject2(Track, True, False, 10, 10)
- 'Set audio to play automatically
- Set oEffect = oSlide.TimeLine.MainSequence.AddEffect(oShp, msoAnimEffectMediaPlay, , msoAnimTriggerWithPrevious)
- oEffect.MoveTo 1
- 'Hide during slide show
- With oEffect
- .EffectInformation.PlaySettings.HideWhileNotPlaying = True
- End With
- End Sub
复制代码
源文件在此,谢谢!
0000 The Graham Norton Show S22E15.zip
(48.13 KB, 下载次数: 2)
|
|