Test Case: C7.00.00

Title: Calling Method, Setting Property in VBA in Word

Platforms: Windows NT 3.51, 4.0, Windows 95
Requirements: Office97 app, OLE control
Sample Apps: Microsoft Word 97, 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:

 

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

' Word

Sub Test()

Set myCB=ActiveDocument.Shapes.AddOLEControl(ClassType:="O97CTRL.O97TestCtrl.1")

With myCB.OLEFormat.Object

.AboutBox

.MyMethod

Set myObj = .Object

End With

With myObj

.Caption = "My Caption"

Debug.Print .Caption

Debug.Print Str(.ReadyState)

End With

End Sub

 

Result:

Control added to document, properties and methods invoked successfully.

Summary:

This tests whether the control can be manipulated from VBA.