LoadPicture Method Example

The following example uses the LoadPicture method to load a metafile into an ActiveX control on an Employees form.

Sub DisplayGraphic()
    Const strConPathToBitmaps = "C:\Program Files\Microsoft Office\Office\Bitmaps\Styles\"

    ' Declare object variables of type Picture and Control.
    Dim objPicture As Object, ctl As Control

    ' Set Control variable to refer to ActiveX control on form.
    Set ctl = Forms!Employees!SomeCustomControl
    ' Assign return value of LoadPicture to Picture object.
    Set objPicture = LoadPicture(strConPathToBitmaps & "Globe.wmf")
    ' Set Picture property of ActiveX control.
    Set ctl.Picture = objPicture
End Sub