How to automate PowerPoint using VB
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
分类:
VB/ASP
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?