PPT2000: Inserted Script Runs Twice When Previewed (226699)



The information in this article applies to:

  • Microsoft PowerPoint 2000

This article was previously published under Q226699

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 (VB Script) 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. 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. 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>
				

Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbprb KB226699