Class Presentations (PowerPoint VBA)

A collection of all the Presentation objects in Microsoft PowerPoint. Each Presentation object represents a presentation that's currently open in PowerPoint. To use a Presentations class variable it first needs to be instantiated, for example

Creates a presentation. Returns a Presentation object that represents the new presentation.

The WithWindow parameter value can be one of these MsoTriState constants.

Add ( WithWindow )

WithWindow: Whether the presentation appears in a visible window.

CanCheckOut

Returns True if Microsoft PowerPoint can check out a specified presentation from a server.

To take advantage of the collaboration features built into PowerPoint, you must store presentations on a Microsoft Office SharePoint Portal Server.

CanCheckOut ( FileName )

FileName: The server path and name of the presentation.

Copies a specified presentation from a server to a local computer for editing. Returns a String that represents the local path and file name of the presentation checked out.

To take advantage of the collaboration features built into Microsoft PowerPoint, presentations must be stored on a Microsoft Office SharePoint Portal Server.

CheckOut ( FileName )

Returns the number of objects in the specified collection.

Returns a single Presentation object from the specified Presentations collection.

Item ( Index )

Index: The name or index number of the single Presentation object in the collection to be returned.

Opens the specified presentation. Returns a Presentation object that represents the opened presentation.

With the proper file converters installed, Microsoft Office PowerPoint 2003 and earlier versions open files with the following MS-DOS file name extensions: .ch3, .cht, .doc, .htm, .html, .mcw, .pot, .ppa, .pps, .ppt, .pre, .rtf, .sh3, .shw, .txt, .wk1, .wk3, .wk4, .wpd, .wpf, .wps, and .xls. PowerPoint also opens files with the following file name extensions: .docm, .docx, .mhtml, .potm, .potx, .ppam, .pptm, .pptx, .ppsm, .ppsx, .thmx, .xlsm, and .xlsx. The ReadOnly parameter value can be one of these MsoTriState constants.

Open ( FileName , ReadOnly , Untitled , WithWindow )

The following argument is required

FileName (String) - The name of the file to open.

Optional arguments

The following arguments are optional

ReadOnly (Office.MsoTriState) - Specifies whether the file is opened with read/write or read-only status.

Untitled (Office.MsoTriState) - Specifies whether the file has a title.

WithWindow (Office.MsoTriState) - Specifies whether the file is visible.

Opens the specified presentation and provides the option to repair the presentation file. Returns a Presentation object that represents the opened presentation.

Open2007 ( FileName , ReadOnly , Untitled , WithWindow , OpenAndRepair )

OpenAndRepair (Office.MsoTriState) - Specifies whether to repair the file before it is opened to prevent corruption.

PowerPoint s Presentation Object

For example, to open a presentation named Proposal.ppt in the C:\My Documents folder, you would use the following statement:

Creating a New Presentation

If you need to create a new presentation, use the Presentations collection's Add method:

WithWindow is a Boolean value that determines whether or not the presentation is created in a visible window. Use True for a visible window (this is the default); use False to hide the window.

Presentation Object Properties

Here's a list of a few common properties associated with Presentation objects:

Presentation .FullName ” Returns the full pathname of the specified Presentation . The full pathname includes the presentation's path (the drive and folder in which the file resides) and the filename.

Presentation .Name ” Returns the filename of the Presentation .

Presentation .Path ” Returns the path of the Presentation file.

Presentation .Saved ” Determines whether changes have been made to the specified Presentation since it was last saved.

Presentation .SlideMaster ” Returns a Master object that represents the slide master for the specified Presentation .

Presentation .Slides ” Returns a Slides object that represents the collection of Slide objects contained in the specified Presentation .

Presentation .SlideShowSettings ” Returns a SlideShowSettings object that represents the slide show setup options for the specified Presentation .

Presentation .TitleMaster ” Returns a Master object that represents the title master for the specified Presentation .

Presentation Object Methods

A Presentation object has methods that let you save the presentation, close it, print it, and more. Here are the methods you'll use most often:

Presentation .ApplyTemplate ” Applies a design template to the specified Presentation . This method uses the following syntax:

For example, the following statement applies the Dads Tie template to the active presentation:

Presentation .Close ” Closes the specified Presentation . If the file has unsaved changes, PowerPoint will ask the user if he or she wants to save those changes.

Presentation .NewWindow ” Opens a new window for the specified Presentation .

Presentation .PrintOut ” Prints the specified Presentation using the following syntax:

Presentation .Save ” Saves the specified Presentation . If the presentation is new, use the SaveAs method instead.

Presentation .SaveAs ” Saves the specified Presentation to a different file. Here's the syntax for the SaveAs method:

The Juggling Application

Throughout this chapter, I'll put the PowerPoint objects, methods, and properties that we talk about to good use in an application that builds an entire presentation from scratch. This presentation will consist of a series of slides that provide instructions on how to juggle.

The code for the application consists of six procedures:

Main ” This procedure ties the entire application together by calling each of the other procedures in the module. CreateJugglingPresentation ” This procedure creates a new Presentation object and saves it. AddJugglingSlides ” This procedure adds the slides to the presentation and then formats them. SetUpStartPage ” This procedure adds and formats text for the presentation title page. SetUpJugglingPages ” This procedure adds and formats a title, picture, and instruction text for each of the four pages that explain how to juggle. RunJugglingSlideShow ” This procedure asks the user if he or she wants to run the slide show and then runs it if Yes is chosen .

To get started, Listing 9.1 shows the Main procedure.

Listing 9.1. This Procedure Ties Everything Together by Calling Each of the Code Listings Individually

First, the pres variable is declared as a Presentation object. Notice that this variable is defined at the top of the module, before any of the procedures. When you define a variable like this, it means that it can be used in all the procedures in the module. Then Main begins by calling the CreateJugglingPresentation procedure, shown in Listing 9.2. From there, the other procedures (discussed later in this chapter) are called, and the presentation is saved.

Listing 9.2. This Procedure Creates a New Presentation and then Saves It

A For Each...Next loop runs through each open presentation and checks the Name property. If it equals Juggling.ppt , we know the file is already open. If it's open (say, from running the application previously), the procedure closes it without saving it. The pres variable is Set and then the presentation is saved using the SaveAs method.

Absolute Beginner's Guide to VBA

  • Optimizing Search Performance
  • Reading and Writing LDAP Attributes
  • Techniques for Extending the Schema
  • Useful Shortcuts for Developers
  • Performing Multiple-table Queries and Creating SQL Data Views
  • Retrieving and Manipulating Data Through Cursors
  • Monitoring and Enhancing MS-SQL Server Performance
  • Working with Stored Procedures
  • Exploiting MS-SQL Server Built-in Stored Procedures
  • IPsec Standards
  • Cisco VPN Client Interface
  • Routers as Certificate Authorities
  • Easy VPN Remote Support for 6.x
  • Creating a Typography Workspace
  • White Space Characters
  • Stylistic Sets
  • Creating Styles
  • Sheared Type
  • What Is InfoPath?
  • Advanced Topic: Dynamic Host Items
  • The Windows Forms Control Hosting Architecture
  • Designing with Classes and Tiers
  • Data Controls
  • MDI Interfaces and Workspaces
  • GDI+ Basics
  • Help and Application-Embedded Support

TeachExcel

  • Excel Courses
  • Free Excel Courses
  • Excel Video Tutorials
  • Excel Keyboard Shortcuts

Premium Excel Course Now Available!

Build professional - unbreakable - forms in excel, 45 tutorials - 5+ hours - downloadable excel files, open a powerpoint presentation from excel, where to install the macro:   module.

'Opens a PowerPoint Document from Excel

Dim objPPT As Object

Set objPPT = CreateObject("PowerPoint.Application") objPPT.Visible = True

'Change the directory path and file name to the location 'of your document

objPPT.Presentations.Open "C:\test.ppt"

Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

  • Select and copy the text from within the grey box above.
  • Open the Microsoft Excel file in which you would like the Macro to function.
  • Press " Alt + F11 " - This will open the Visual Basic Editor - Works for all Excel Versions.   Or For other ways to get there, Click Here . For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon . Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
  • On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
  • Go to the menu at the top of the window and click Insert > Module
  • Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
  • Go to Step 8.
  • Directly underneath your excel file called VBAProject(your file's name here) , click the Microsoft Excel Objects folder icon to open that drop-down list.
  • Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
  • A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
  • Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE) . Select the sheet in which you want the macro to run and double-click that sheet.
  • Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
  • Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
  • You are now ready to run the macro.

Excel Forum

200+ Video Lessons 50+ Hours of Video 200+ Excel Guides

MrExcel Message Board

  • Search forums
  • Board Rules

Follow along with the video below to see how to install our site as a web app on your home screen.

Note: This feature may not be available in some browsers.

  • If you would like to post, please check out the MrExcel Message Board FAQ and register here . If you forgot your password, you can reset your password .
  • Question Forums
  • Excel Questions

PPT opening from excel VBA

  • Thread starter suresh ullanki
  • Start date Jul 31, 2017
  • Tags excel false file_name ppt_open vba

suresh ullanki

Board regular.

  • Jul 31, 2017

Hi, I am trying to open power point using excel vba with the following code. it is not working. Can you please help Sub PPT_Open() File_name = Application.GetOpenFilename("Microsoft PowerPoint-Files (*.pptx*), *.pptx*") If File_name = "False" Then MsgBox "Stopping because you did not select a file" Exit Sub Else PowerPointApp.Presentations.Open = File_name End I  

Excel Facts

Norie

Well-known Member

Is PowerPointApp a reference to an instance of the PowerPoint application you've created/set somewhere else?  

yes it has already created. but file name will be changed every time. and folder name will be changed as well. hence i want to make prompt to open file.  

Try this. Code: PowerPointApp.Presentations.Open FileName:= File_name  

Tried. it is throwing an error saying object required for this line PowerPointApp.Presentations.Open FileName:= File_name  

Where do you define " PowerPointApp"? I wrote a routine to open powerpoint and convert Excel sheets to slides. Here is how I open the base file to add to it: Code: Dim ppApp As PowerPoint.Application Dim ppPres As Presentation Dim ppSlide As Slide Dim ppContentSlide As Slide Dim template As String ' Create instance of PowerPoint Set ppApp = CreateObject("Powerpoint.Application") ' Open the template to create the new presentation template = Workbooks(masterBook).Path & "\" & "Report_Template.pptx" Set ppPres = ppApp.Presentations.Open(template, msoFalse)  

Similar threads

  • reubenjacobc
  • Jun 13, 2023

Jeffrey Mahoney

  • May 18, 2023
  • Sep 12, 2023
  • Oct 18, 2023

NdNoviceHlp

  • Oct 27, 2022

Forum statistics

Share this page.

presentations.open filename

We've detected that you are using an adblocker.

Which adblocker are you using.

AdBlock

Disable AdBlock

presentations.open filename

Disable AdBlock Plus

presentations.open filename

Disable uBlock Origin

presentations.open filename

Disable uBlock

presentations.open filename

presentations.open filename

Contribute to the Microsoft 365 and Office forum! Click  here  to learn more  💡

April 9, 2024

Contribute to the Microsoft 365 and Office forum!

Click  here  to learn more  💡

PowerPoint Top Forum Contributors: Steve Rindsberg  -  John Korchok   👍✅

April 17, 2024

PowerPoint Top Forum Contributors:

Steve Rindsberg  -  John Korchok   👍✅

  • Search the community and support articles
  • Microsoft 365 and Office
  • Search Community member

Ask a new question

I need to open a PowerPoint Presentation on Sharepoint, without checking it out, using VBA in Excel

I'm creating a spreadsheet template that will allow users to enter a bunch of information, and then click a button that will fire a macro to copy all of the information, as a picture, to a PowerPoint presentation and resize/position it to make their slide consistent with everyone else's.

I can do all of the copying and stuff fine, but for the life of me, I can't figure out how to get PowerPoint to open the presentation template I want to use, which is stored in SharePoint.  I don't want to check it out, I just want a copy of it, so I don't think I want to use the Presentation.CheckOut method.  Ideally I'd just like to say something like:

PPApp.Presentations.Open Filename:=" http://inside.company.com/enterprise/EPMO/9Tools/Ops_Review_PMO_Slide_template.pptx "

But that won't seem to work.  I've seen references to it written this way:

PPApp.Presentations.Open "[URL="file://\\MonthlyReports\Carrier\Carrier"]C:\MonthlyReport\testfile[/URL].pptx"

But that didn't seem to work either.

Thanks in advance!

Report abuse

Nevermind - seems like I just needed to assign the URL to a string variable - just putting the URL in quotes wasn't enough for some reason.

This worked:

Dim FullTemplatePath As String Set PPApp = New PowerPoint.Application

FullTemplatePath = " http://inside.nuance.com/enterprise/EPMO/9Tools/Ops_Review_PMO_Slide_template.pptx "

' Open the PowerPoint template PPApp.Presentations.Open (FullTemplatePath)

3 people found this reply helpful

Was this reply helpful? Yes No

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

Replies (3) 

Question info.

  • Norsk Bokmål
  • Ελληνικά
  • Русский
  • עברית
  • العربية
  • ไทย
  • 한국어
  • 中文(简体)
  • 中文(繁體)
  • 日本語

请升级到 Microsoft Edge 以使用最新的功能、安全更新和技术支持。

Presentations.Open 方法 (PowerPoint)

打开指定的演示文稿。 返回一个 Presentation 对象,该对象代表已打开的演示文稿。

表达式 。 打开 ( FileName 、 ReadOnly 、 untitled 、 WithWindow )

表达 一个代表 Presentations 对象的变量。

安装正确的文件转换器后,Microsoft Office PowerPoint 2003 及更早版本打开具有以下 MS-DOS 文件扩展名的文件:.ch3、 .cht、.doc、.htm、.html、.mcw、.pot、.ppa、.pps、.ppt、.pre、.rtf、.sh3、.shw、.txt、.wk1、.wk3、.wk4、.wpd、.wpf、.wps 和 .xls。 PowerPoint 还会打开扩展名为以下的文件:.docm、.docx、.mhtml、.potm、.potx、.ppam、.pptm、.pptx、.ppsm、.ppsx、.thmx、.xlsm 和 .xlsx。

只读的参数值可以是其中一个 MsoTriState 常量。

Untitled 参数值可以是下列 MsoTriState 常量之一。

WithWindow 参数值可以是下列 MsoTriState 常量之一。

本示例以只读状态打开一个演示文稿。

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈 ,获取有关如何接收支持和提供反馈的指南。

即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅: https://aka.ms/ContentUserFeedback 。

IMAGES

  1. How to Open and View PowerPoint Presentations Without PowerPoint or

    presentations.open filename

  2. What is a PPTX file and How to Open It? A Complete Guide!

    presentations.open filename

  3. File names for your presentation

    presentations.open filename

  4. PowerPoint 2016: Creating and Opening Presentations

    presentations.open filename

  5. Getopenfilename Default File Path Definition

    presentations.open filename

  6. Excel: 通过VBA代码打开ppt文件-腾讯云开发者社区-腾讯云

    presentations.open filename

VIDEO

  1. What is a XSD file and how can you open it?

  2. 2 Открытие файла презентации в PowerPoint

  3. How To Open File In Presentation/Slide Show Mode In Power Point

  4. What is a XWM file and how can you open it?

  5. How to Easily Show or View File Name Extensions in Windows 10

  6. C# programe simple media player

COMMENTS

  1. Presentations.Open method (PowerPoint)

    Opens the file with read/write status. Opens the file with read-only status. The Untitled parameter value can be one of these MsoTriState constants. The default. The file name automatically becomes the title of the opened presentation. Opens the file without a title. This is equivalent to creating a copy of the file.

  2. Open a PowerPoint presentation from Excel with VBA and then set that

    Dim myPresentation As PowerPoint.Presentation Dim PowerPointApp As PowerPoint.Application PowerPointApp.Presentations.Open Filename:="obscured filepath and name"` Obviously there's some additional code, but I'm trying to set the Presentation I just opened in line 3 set to the MyPresentation variable so I can reference the document I just opened.

  3. PowerPoint class Presentations VBA

    Class Presentations (PowerPoint VBA) A collection of all the Presentation objects in Microsoft PowerPoint. Each Presentation object represents a presentation that's currently open in PowerPoint. To use a Presentations class variable it first needs to be instantiated, for example. Presentations class variables can be set using the Application ...

  4. Excel VBA Open Powerpoint File

    Sub openppt() Dim PPT As Object Set PPT = CreateObject("Powerpoint.Application") PPT.Visible = True PPT.Presentations.Open Filename:=[COLOR=#333333]"C:\Topline\Topline Writeup.pptx"[/COLOR] Set PPT = Nothing End Sub . Upvote 0. gmooney Active Member. Joined Oct 21, 2004 Messages 252 Office Version. 365; Platform.

  5. PowerPoint s Presentation Object

    VBA gives you three ways to do this: Use the Presentations object " The Presentations object is the collection of all open presentation files. To specify a particular presentation, either use its index number (where 1 represents the first presentation opened) or enclose the presentation filename in quotation marks.

  6. Open a PowerPoint Presentation from Excel

    You can change the PowerPoint presentation that will open by changing this line of code objPPT.Presentations.Open "C:\test.ppt" so that the directory and file name, including extension, ... 'Change the directory path and file name to the location 'of your document. objPPT.Presentations.Open "C:\test.ppt"

  7. VBA to open PPT using ThisWorkbook.Path and ThisWorkbook.FullName

    Re: [SOLVED] VBA to open PPT using ThisWorkbook.Path and ThisWorkbook.FullName Craggs82, THANK YOU!!!! This worked brilliantly and you've not only clarified how the .fullname works and taught me the incredible value of using replace, you've also unlocked a gem I didn't know existed in using the immediate window. I cannot say thank you enough!!

  8. Powerpoint VBA Presentations File names

    Presentations(".\directory\ppname.ppt") Note that this will be called from within a PowerPoint presentation VBA, to open another one in a sub-directory. The Microsoft Presentations examples (and most others) are not specific about the filename forms accepted, e.g. those using the ".", "..", "\" directives recognized in DOS scripts. vba.

  9. PPT opening from excel VBA

    I am trying to open power point using excel vba with the following code. it is not working. Can you please help Sub PPT_Open() File_name = Application.GetOpenFilename("Microsoft PowerPoint-Files (*.pptx*), *.pptx*") If File_name = "False" Then MsgBox "Stopping because you did not select a file" Exit Sub Else PowerPointApp.Presentations.Open ...

  10. I need to open a PowerPoint Presentation on Sharepoint, without

    I need to open a PowerPoint Presentation on Sharepoint, without checking it out, using VBA in Excel I'm creating a spreadsheet template that will allow users to enter a bunch of information, and then click a button that will fire a macro to copy all of the information, as a picture, to a PowerPoint presentation and resize/position it to make ...

  11. Controlling PowerPoint w/ Python via COM32

    class ppt: def __init__(self): self.objCOM = app.Presentations.Open(FileName="path_to_file", WithWindow=1) We now have an object, 'ppt', that contains another object, 'objCOM', that is a ...

  12. vba

    presentations.Open() may fail if you pass a relative path as parameter. The reason is that PowerPoint uses its own working directory which is usually different from the working directory of the calling application. The solution is to pass an absolute path rather than a relative one. answered Jul 19, 2023 at 19:20.

  13. Open method not working to open ppts from a ppt

    Dim SourceFolder As String Dim TargetFolder As String SourceFolder = "c:\source" TargetFolder = "c:\target" Dim Slide As Long Dim SourcePresentation As Presentation Dim SourcePresentationName As String Dim TargetFileName As String Dim SourceNamePath Debug.Print "-- Start -----" ActiveWindow.ViewType = ppViewNormal 'Loop through ppt* files only ...

  14. Set PowerPoint presentation when already opened (From Excel)

    I am using a slightly different code: ppProgram is PowerPoint.Application. ppPres is PowerPoint.Presentation. ppFullPath is the full path (Path & File Name). ppName is the "clean" Name of the requested Presentation ' more than 1 Presentstion open If ppProgram.Presentations.Count > 0 Then ppName = Mid(ppFullPath, InStrRev(ppFullPath, "\") + 1, Len(ppFullPath)) i = 1 Do Until i = ppProgram ...

  15. Presentations.Open メソッド (PowerPoint)

    Presentations.Open FileName:="C:\My Documents\pres1.pptx", ReadOnly:=msoTrue 関連項目. プレゼンテーション オブジェクト. サポートとフィードバック. Office VBA またはこの説明書に関するご質問やフィードバックがありますか?

  16. Presentations.Open 方法 (PowerPoint)

    Presentations.Open FileName:="C:\My Documents\pres1.pptx", ReadOnly:=msoTrue 另请参阅. 演示文稿对象. 支持和反馈. 有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。