刚在别人帖了里看到这句话
ActivePresentation.SlideShowSettings.ShowType = ppShowTypeWindow
目的是使vb里的powerpoint以窗口而非全屏模式播放。但我怎么也没看懂。这句话应该怎么用,放在哪里?里面的ActivePresentation、SlideShowSettings、ShowType以及后面的ppShowTypeWindow分别是什么意思,请高手指教
ActivePresentation.SlideShowSettings.ShowType = ppShowTypeWindow
目的是使vb里的powerpoint以窗口而非全屏模式播放。但我怎么也没看懂。这句话应该怎么用,放在哪里?里面的ActivePresentation、SlideShowSettings、ShowType以及后面的ppShowTypeWindow分别是什么意思,请高手指教
ActivePresentation是不是你ppt对象里面的属性啊?
返回一个 Presentation 对象,该对象代表在活动窗口中打开的演示文稿。只读。请注意,如果嵌入的演示文稿是即时激活的,则 ActivePresentation 属性返回该嵌入演示文稿。
SlideShowSettings 属性
返回一个 SlideShowSettings 对象,该对象代表指定演示文稿的幻灯片放映设置。只读。
ShowType 属性
返回或设置指定幻灯片放映的放映类型。可为下列 PpSlideShowType 常数之一: ppShowTypeKiosk、 ppShowTypeSpeaker 或 ppShowTypeWindow。可读写。Long 类型。----------------- Dim pptApp As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation Set pptApp = New PowerPoint.Application
Set pptPres = pptApp.Presentations.Open("e:\chap2.ppt") ..... pptPres.SlideShowSettings.ShowType = ppShowTypeWindow.....
pptPres.SlideShowSettings.Run
Dim pptApp As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation
这里的PowerPoint.Application和PowerPoint.Presentation是什么,我真接粘到代码里不行,说这是用户未定义类型,我试过用ole控件和直接用可插入对像show和slide都不行,能给个具体的做法吗?谢谢了
pptApp.Visible = TrueSet pptPres = a.Presentations.Open("e:\chap2.ppt") 'Presentation 对象With pptPres.SlideShowSettings
.ShowType = 2
.Run
End With
我这里是打开已有的文件
实时错误'-2147188160(80048240)':
presentations(unknow member);invalid request.The powerpoint frame window does not exist.
我也在E:盘下放了一个chap2.ppt,怎么会出现这样的错误呢
实时错误'-2147188160(80048240)':
presentations(unknow member);invalid request.The powerpoint frame window does not exist.你有这句吗?
pptApp.Visible = True
我不知道你的代码?要不这样
OLE1.object.SlideShowSettings.ShowType = 2
OLE1.object.SlideShowSettings.Run
楼上大哥,我用你下面的代码
OLE1.object.SlideShowSettings.ShowType = 2
OLE1.object.SlideShowSettings.Run
可以了,谢谢大哥。
你这些代码从哪里能学到,为什么我在键入OLE1.object.的时候不会出现任何属性、方法之类的代码提示
我在窗体上放了一个OLE1控件
又用菜单编辑器加了个菜单->文件
然后写下如下代码
Private Sub Form_Load()
OLE1.CreateEmbed "c:\vb\q.ppt"
OLE1.object.SlideShowSettings.ShowType = 2
End Sub
现在运行后双击ole1可以以窗口形式播放powerpoint,这正是我梦寐以求的效果。可是新问题随之而来,powerpoint在播放时把我的form的菜单替换成它的菜单了,这怎么解决?
=========================
这是因为object是一个后期运行时才进行绑定的对象,设计时不知道你绑定的是什么,自然不会出现自动完成提示,只要你的对象有那个属性就可以了
SlideShowWindow 对象
....
With ActivePresentation.SlideShowSettings
.ShowType = ppShowTypeSpeaker
With .Run
.Height = 300
.Width = 400
End With
End With--------------------------------
With OLE1.object.SlideShowSettings
.ShowType = 1 'ppShowTypeSpeaker=1,ppShowTypeWindow=2,...
With .Run
.Left = Me.ScaleX(Me.Left + OLE1.Left + 50, vbTwips, vbPoints)
.Top = Me.ScaleY(Me.Top + OLE1.Top + 380, vbTwips, vbPoints)
.Width = Me.ScaleX(OLE1.Width, vbTwips, vbPoints)
.Height = Me.ScaleY(OLE1.Height, vbTwips, vbPoints)
End With
End With