Run Method

Microsoft PowerPoint Visual Basic

ShowRun method as it applies to the SlideShowSettings object.

Runs a slide show of the specified presentation. Returns a SlideShowWindow object.

expression.Run

expression    Required. An expression that returns one of the above objects.

Remarks

To run a custom slide show, set the RangeType property to ppShowNamedSlideShow, and set the SlideShowName property to the name of the custom show you want to run.

ShowRun method as it applies to the Application object.

Runs a Visual Basic procedure.

Note  Because macros can contain viruses, be careful about running them. Take the following precautions: run up-to-date antivirus software on your computer; set your macro security level to high; clear the Trust all installed add-ins and templates check box; use digital signatures; maintain a list of trusted publishers.

expression.Run(MacroName, safeArrayOfParams)

expression    Required. An expression that returns one of the above objects.

MacroName   Required String. The name of the procedure to be run. The string can contain the following: a loaded presentation or add-in file name followed by an exclamation point (!), a valid module name followed by a period (.), and the procedure name. For example, the following is a valid MacroName value: "MyPres.ppt!Module1.Test."

safeArrayOfParams   Required Variant. The argument to be passed to the procedure. You cannot specify an object for this argument, and you cannot use named arguments with this method. Arguments must be passed by position.

Example

ShowAs it applies to the SlideShowSettings object.

This example starts a full-screen slide show of the active presentation, with shortcut keys disabled.

With ActivePresentation.SlideShowSettings
    .ShowType = ppShowSpeaker
    .Run.View.AcceleratorsEnabled = False
End With
				

This example runs the named slide show "Quick Show."

With ActivePresentation.SlideShowSettings
    .RangeType = ppShowNamedSlideShow
    .SlideShowName = "Quick Show"
    .Run
End With
				

ShowAs it applies to the Application object.

In this example, the Main procedure defines an array and then runs the macro TestPass, passing the array as an argument.

Sub Main()
    Dim x(1 To 2)
    x(1) = "hi"
    x(2) = 7
    Application.Run "TestPass", x
End Sub

Sub TestPass(x)
    MsgBox x(1)
    MsgBox x(2)
End Sub