|
这个没法做。原理是这样的,当你插入音乐,音乐图标自动就有一个触发器,这是触发ClockMusic.mp3,
当你用“”矩形1“触发这个音乐图标,就是空的。它不能触发音乐。
给你两段代码,都是完整的,请参考下。审核需要时间。
- Sub InsertMp3()
- Dim shp1 As Shape, shp2 As Shape, oEffect As Effect, L As Single, T As Single, W As Single, H As Single, myPath$
- myPath = "c:" & "\ClockMusic.mp3"
- L = W - 60 '左边距
- T = H - 50 '上边距
- Set shp1 = ActivePresentation.Slides(1).Shapes.AddShape(msoShapeRectangle, 170, 190, 130, 28)
- Set shp2 = ActivePresentation.Slides(1).Shapes.AddMediaObject(myPath, L, T, 48, 48)
- Set oEffect = ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add().AddEffect(Shape:=shp2, effectId:=msoAnimEffectCustom, trigger:=msoAnimTriggerOnShapeClick)
- With oEffect.Timing
- .Duration = 5
- .TriggerShape = shp1
- End With
-
- End Sub
- Sub AddShapeSetTiming()
- '向幻灯片添加两个形状,并对该形状添加动画,然后在单击其他形状后开始动画。
- Dim effDiamond As Effect
- Dim shp2 As Shape
- Set shp1 = ActivePresentation.Slides(1).Shapes.AddShape(Type:=msoShapeOval, Left:=400, Top:=100, Width:=100, Height:=50)
- Set shp2 = ActivePresentation.Slides(1).Shapes.AddShape(Type:=msoShapeRectangle, Left:=100, Top:=100, Width:=50, Height:=50)
- Set effDiamond = ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add().AddEffect(Shape:=shp2, effectId:=msoAnimEffectPathDiamond, trigger:=msoAnimTriggerOnShapeClick)
- With effDiamond.Timing
- .Duration = 5
- .TriggerShape = shp1
- End With
- End Sub
复制代码
|
|