PPT2000: Inserted Script Runs Twice When Previewed

ID: Q226699


The information in this article applies to:


SYMPTOMS

If you edit script in a Microsoft PowerPoint presentation, the script may not function the way you expect. Specifically, JScript and Visual Basic Scripting Edition (VBScript) code may execute twice when you view it in Internet Explorer.


CAUSE

This behavior is caused by the translation of a PowerPoint presentation with multiple slides into XML. Each slide object in the Project Explorer is read twice. It is read once for Slide view and once for Notes view. Script that is not customized for a specific view will execute each time the slide object is read.

NOTE: Single slide presentations are only read for Slide View.


MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/refguide/
IMPORTANT: The script generated by a Microsoft PowerPoint presentation is highly technical. Editing this script is recommended only for developers and programmers with extensive knowledge of both product and scripting language. Improper editing of script generated by Microsoft PowerPoint can produce unwanted results, including permanent loss of data.

You can customize your code to run for only one type of view by basing your code on the following examples. The desired code is enclosed within an IF THEN statement that tests for the condition IsNts (for the Notes view) or IsSld (for the Slide view).

Example One: Visual Basic Script

This example generates a message box that states "Hello World!" each time you navigate to slide one by inserting code immediately before the </head> tag in the Slide1 Object in the Project Explorer.

Use the following code example to properly insert the script.

<script language="VBScript">
<!--
'If reading for Notes view, then execute code
'Code will not run in one slide presentation, as Notes are not generated
if IsNts() then msgbox "Hello World!"
-->
</script> 

Example Two: JScript

This example generates a message box that states "Hello World!" each time you navigate to slide one by inserting code immediately before the </head> tag in the Slide1 Object in the Project Explorer

Use the following code example to properly insert the script.

<script><!--
/*If reading for Notes view, then execute code
Code will not run in a one slide presentation as notes are not generated*/ 
if( IsNts() ) alert("JScript: Hello World!");
//-->
</script> 

Additional query words: PPT2K PPT2000 PPT POWERPNT 2000 PPT9 9.0 double duplicate respawn


Keywords          : kbdta kbVBScript 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: June 28, 1999