Test Case: C7.02.00

Title: Calling Method, Setting Property in VBA in PowerPoint

Platforms: Windows NT 3.51, 4.0, Windows 95
Requirements: Office97 app, OLE control
Sample Apps: Microsoft Powerpoint97, MFC Control Wizard generated control
Test Category: CONTROL

Overview:

This sample code illustrates adding a 'test' control, and calling methods and setting properties on that control from VBA. Obviously the properties and methods will vary by control.

Steps:

 

'------------------------------------

'Powerpoint

Sub Test()

Dim p As Presentation, l As Integer, t As Integer, w As Integer, h As Integer

Set p = Presentations.Add(True)

With p.Slides.Add(1, ppLayoutBlank).Shapes

l = p.PageSetup.SlideWidth / 4

t = p.PageSetup.SlideHeight / 4

w = p.PageSetup.SlideWidth / 2

h = p.PageSetup.SlideHeight / 2

With .AddOLEObject(Left:=l, Top:=t, Width:=w, Height:=h, ClassName:="O97CTRL.O97TestCtrl.1")

With .OLEFormat.Object

.Caption = "This is a button"

.AboutBox

.MyMethod

End With

End With

End With

End Sub

 

Result:

Control added to slide, properties and methods invoked successfully.

Summary:

This tests whether the control can be manipulated from VBA.