Microsoft KB Archive/271898

= PPT2000: Macros Disabled When You Open Presentations Programatically =

Article ID: 271898

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft PowerPoint 2000 Standard Edition

-



This article was previously published under Q271898



SYMPTOMS
In Microsoft Visual Basic for Applications (VBA), when you use the Presentations.Open method in one presentation to open another presentation that contains macros, PowerPoint opens the new presentation, but disables all of the macros. There is no way to change this behavior in the Presenations.Open method.



CAUSE
Typically, when you open a presentation that contains macros, you receive the Macro Warning dialog box. However, the Macro Warning dialog box does not appear when you use the Presentation.Open method in VBA. The Presentation.Open method has no option to open a presentation and run its macros.

This behavior is designed to protect your computer from malicious code.



WORKAROUND
Microsoft 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.

Sample Code
The following sample code opens a PowerPoint presentation, and then closes the current, active presentation. If the new presentation contains macros, you receive a macro virus warning.

To accomplish this, the macro creates a batch file and opens the new presentation by using the batch file, instead of the Presentations.Open method. Sub NextPres ' ' Purpose: You can use this macro to follow a hyperlink to another '         presentation, and close the current, active presentation. '         Typically, PowerPoint leaves the current presentation '         open when it follows a hyperlink. ' ' Result: This macro calls the next presentation in line '        (strPath). It then closes this presentation. ' ' NOTE: If the presentation that is being called contains a '      macro, you are presented with the macro warning '      dialog box. '   Dim strPath     As String Dim strPPT     As String Dim lngRet     As Long Dim presMe     As Presentation ' Capture the active presentation. Set presMe = ActivePresentation ' Set the path to the PowerPoint executable file. strPPT = Chr(34) & &quot;c:\program files\microsoft &quot; _ & &quot;office\office\powerpnt.exe&quot; & Chr(34)

' Set the path to the &quot;next&quot; presentation to link to. ' NOTE: This is in the same &quot;path&quot; as the active presentation. strPath = presMe.Path & &quot;\Next.ppt&quot;

' Create a batch file in the path of the active presentation. Open presMe.Path & &quot;\ppt.bat&quot; For Output As #1

' Write the full path of the PowerPoint .exe file, followed by the ' full path to the next file. ' NOTE: The &quot;/s&quot; is added to the path so that PowerPoint '      opens in slide show mode. Print #1, strPPT & &quot; /s &quot; & strPath Close #1 ' Run the batch file made above. lngRet = Shell(presMe.Path & &quot;\ppt.bat&quot;) ' Minimize the PowerPoint window. Application.WindowState = ppWindowMinimized ' Close the current presentation. presMe.Close End Sub



STATUS
This feature is under review and will be considered for inclusion in a future release.

Keywords: kbbug kbnofix KB271898

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.