Ken Lassesen
Microsoft Developer Network Technology Group
October 11, 1995
Click here for a diagram of the Standard OLE Types Object Library in various graphics formats.
This article consists primarily of a graphic map of the Standard OLE Types Object Library (StdType), showing its properties, methods, and objects. This object allows faster and less resource-intensive manipulation of pictures and control fonts. Visual C ++™ and products that contain Visual Basic® for Applications can access the Standard OLE Types object.
The Standard OLE Types Object Library enables the developer to manipulate pictures and fonts. These types allow manipulation of fonts and pictures independent of forms and controls.
The Standard OLE Types object (StdType) is accessible from Visual C++™ version 4.0 and many products that contain Visual Basic® for Applications, including Microsoft® Excel version 5.0 and higher, Microsoft Access 95, Visual Basic version 4.0, and Microsoft Project. For further information on using this object, see the documentation for these products, and search the Development Library CD. A good starting point is the Visual Basic 4.0 Help file.
Figure 1 shows the relationship between objects as described by the Object Viewer and online Help files. A map is a good learning aid and a quick reference when developing an application. After producing a map, I found that it was easy to work with the object: I just post the appropriate map on my wall for quick reference, which is a lot faster than clicking objects in a Help file one by one to discover their properties and methods.
Because Figure 1 is difficult to read online, I have included the two most common graphics formats—encapsulated PostScript™ (.EPS) and Windows® metafile (.WMF)—as well as a copy of my original Shapeware® Visio™ version 4.0 file (.VSD). The first two formats can be printed across multiple pages using any of the commercial graphics applications—such as Adobe™ PageMaker™, Corel® Draw, or Microsoft Publisher—or using Microsoft Excel. The original Visio file is included for those who have a copy of Visio and wish to modify the diagram easily.
Figure 1. The Standard OLE Types object
The objects and collections in Figure 1 are defined in Table 1. The objects are listed in the same sequence as they appear in the map.
Table 1. Object and Collection Definitions
Object or Collection | Definition |
Font object StdFont object [for New] |
These objects contain information needed to format text for display in the interface of an application or for printed output. |
Picture object StdPicture object [for New] |
These objects manipulate bitmaps, icons, and metafiles. |
This object library has some cool uses that are not obvious. The following shows how it is possible to change all the fonts on a form with a single line of code from an OLE Automation controller application. I placed the code in a class module to illustrate how exposing a Font property as part of a class saves writing each individual font characteristic as a separate property.
'In Class1.Cls
Dim ThisFormFont As New StdType.StdFont
Private Sub Class_Initialize()
ThisForm1.Visible = True
On Error Resume Next 'In case no font in control
For i% = 0 To ThisForm1.Controls.Count
Set ThisForm1.Controls(i%).Font = ThisFormFont
'This causes ALL control fonts to point to ThisFormFont.
Next i%
On Error GoTo 0
End Sub
Public Property Get Font()
Set Font = ThisFormFont
End Property
This enables any OLE Automation controller to change all of the fonts in one command, as shown below.
'CONTROLLER application
Dim x As New Project1.Class1
Sub ChangeFormToItalic()
Dim AFont As Font
Set AFont = x.Font 'This causes Afont to point to X.Font.
AFont.Italic = True
End Sub
Lassesen, Ken. "Using Microsoft OLE Automation Servers to Develop Solutions." October 1995. (MSDN Library, Technical Articles)
"Visual Basic Reference" (VB.HLP) is installed with Visual Basic version 4.0.