Article ID: 162555 - Last Review: October 11, 2006 - Revision: 2.2 PPT97: How to Use the Presentations.Open MethodThis article was previously published under Q162555 On This PageSUMMARY
This article describes how to use the Microsoft Visual Basic for
Applications Presentations.Open method. The Open method opens an existing
Microsoft PowerPoint presentation.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. ParametersThere are four parameters that you can use to control the behavior of the Open method:Name Data Type Required ---- --------- -------- FileName String Yes ReadOnly Long Optional Untitled Long Optional WithWindow Long Optional
The FileName parameter is the path and name of the presentation you wish to
open. The following Visual Basic example opens a file named test.ppt
located in the C:\ root directory.
ReadOnly:
The ReadOnly parameter is used to open a presentation as Read-Only. The
following example opens a file named test.ppt as Read-Only.
Untitled:
[test.ppt[Read-Only]]
If you do not specify the msoTrue parameter, it is set to msoFalse (the
default), and the presentation opens as read/write.
The Untitled parameter is used to create a copy of the presentation. The
following example opens a copy of test.ppt.
WithWindow:
[test.ppt]
The WithWindow parameter open a presentation without making it
visible. The following example opens test.ppt, does not show it, and then
closes it.
If you do not specify the msoFalse parameter, it is set to msoTrue (the default). This code example: Using the Return ValueThe Open method returns a reference to a presentation object. Once you have the object reference, you can use it to access methods and properties of the presentation.Error Trapping the Open MethodThe following sample code demonstrates how you can trap errors that may occur when using the Open method:For more information about the Err object, search the Help Index for "Err," or ask the Microsoft PowerPoint 97 Office Assistant. REFERENCES
For additional information about getting help with Visual Basic for
Applications, please see the following article in the Microsoft Knowledge
Base:
163435
(http://support.microsoft.com/kb/163435/EN-US/
)
VBA: Programming Resources for Visual Basic for Applications
| Article Translations
|

Back to the top
