How to automate PowerPoint using VB
2024-08-30 06:34:26
Microsoft has an article that explains how to automate PowerPoint using VB
For some odd reason they've entitled it How to automate Powerpoint using VB
Here's a quick example:
Sub AutomatePowerPoint()
' This requires that you set a reference to PowerPoint in Tools, References
' You could later change these to As Object to avoid that necessity
Dim oPPTApp As PowerPoint.Application
Dim oPPTPres As PowerPoint.Presentation
Dim sPresentationFile as String sPresentationFile = "C:\MyFiles\Somefile.PPT" ' Get a reference to PowerPoint app
Set oPPTApp = New PowerPoint.Application
' set it visible or you may get errors - there are ways around this but they're
' beyond the scope of this FAQ
oPPTApp.Visible = True
' minimize if you want to hide it:
' oPPTApp.WindowState = ppWindowMinimized ' Open our source PPT file, get a reference to it
Set oPPTPres = oPPTApp.Presentations.Open(sPresentationFile) With oPPTPres ' Do stuff ...
' Show the number of slides in the file, for example
msgbox .Slides.Count
End With ' Cleanup
' Close the presentation
oPPTPres.Close
' Quit PPT
oPPTApp.Quit
' Release variables
Set oPPTPres = Nothing
Set oPPTApp = Nothing End Sub url:http://www.pptfaq.com/FAQ00115_How_to_automate_PowerPoint_using_VB.htm
最新文章
- ScrollView 嵌套ListView、RecyclerView(持续更新)
- 什么是Alpha通道?
- 为什么js加事件时不要写括号
- How-to: Enable User Authentication and Authorization in Apache HBase
- .net5的异步
- DOM与元素节点内联样式
- fastjson是阿里巴巴的开源JSON解析库
- 验证码I
- SQL入门经典(一)之简介
- 如何把匿名类型.GetType()返回的对象传进泛型里面[转]
- ";ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源, 或者超时失效";的快速解决方法
- html的空格显示距离问题
- 高效开发之SASS篇
- zoj 1508 poj 1201 Intervals
- arcgis api for js入门开发系列九热力图效果
- [2012-06-18]awk利用关联数组合并记录
- [bzoj5016][Snoi2017]一个简单的询问
- (六)QDialog,QMessageBox,QFileDialog,QColorDialog颜色,QFontDialog字体
- Spring详解(七)------AOP 注解
- HDU 1077