|
本帖最后由 weiyingde 于 2016-9-8 08:29 编辑
我在slidemaster中设置一个切换按钮,控制在幻灯片放映下将当前路径的视频插入到当前放映幻灯片中,并要求其自动播放,为什不能实现?大侠就我。
代码如下:
Private Sub CommandButton1_Click()
On Error Resume Next
Randomize
x = Int(8 * Rnd + 1)
With Excel.Application.WorksheetFunction
bs = .Choose(x, &H0, &HFF0000, &H46170B, &H542E08, &HE22B8A, &H212429, &HE16941, &HF5E38, FF6EC7)
qs = .Choose(x, &HD7EBFA, &HFF, &HFF901E, &HD4FF7F, &HFC7C, &HFF00FF, &HFF7F, &HFFFF00, E6E8FA)
zt = .Choose(x, "华文楷体", "黑体", "方正魏碑简体", "方正启体简体", "全新硬笔楷书简", "华文中宋", "汉鼎简特粗黑", "华文隶书", "华文行楷")
End With
With Me.CommandButton1
If .Caption = "插入视频并自动播放" Then
.Caption = "删除本视频"
.BackColor = bs
.ForeColor = qs
.Font.Name = zt
.Font.Size = 16
.Font.Italic = True
Call 插入视频
Exit Sub
End If
If .Caption = "删除本视频" Then
.Caption = "插入视频并自动播放"
.BackColor = bs
.ForeColor = qs
.Font.Name = zt
.Font.Size = 18
.Font.Italic = False
Call 删除视频
Exit Sub
End If
End With
End Sub
Sub 插入视频()
h = ActivePresentation.PageSetup.SlideHeight * 2 / 3
w = ActivePresentation.PageSetup.SlideWidth * 2 / 3
l = w / 8
t = h / 8
ipth = ActivePresentation.Path
filnm = ipth & "\蛇吞人.wmv"
For Each shp In ActivePresentation.SlideShowWindow.View.Slide.Shapes
If shp.Type = 16 Then shp.Delete
Next
Set shp = Nothing
Set shps = ActivePresentation.SlideShowWindow.View.Slide.Shapes
Set sp = shps.AddMediaObject2(FileName:=filnm, Left:=l, Top:=t, Width:=w, Height:=h)
With sp
Randomize
.AutoShapeType = Choose(Int(Rnd * 9) + 1, 6, 9, 10, 132, 13, 28, 94, 95, 96)
With .ThreeD
If sj Mod 2 = 1 Then
.SetThreeDFormat msoThreeD & (Int(Rnd * 20) + 1)
Else
.BevelTopType = 3
.BevelTopDepth = 10
.BevelBottomType = 3
.BevelBottomDepth = 6
End If
End With
End With
With sp.AnimationSettings.PlaySettings
.PlayOnEntry = True
.PauseAnimation = False
End With
End Sub
Sub 删除视频()
For Each shp In ActivePresentation.SlideShowWindow.View.Slide.Shapes
If shp.Type = 16 Then shp.Delete
Next
End Sub
附件如下见下一楼:
|
|