DlgSetPicture

Syntax

DlgSetPicture Identifier[$], PictureName$, PictureType

Remarks

Used in a dialog function to set the graphic displayed by a Picture dialog box control whose identifier is Identifier[$].

Argument

Explanation

Identifier[$]

The string or numeric identifier of the dialog box control.

PictureName$

The name of the graphics file, AutoText entry, or bookmark containing the graphic to be displayed. If the picture does not exist, Word displays the text "(missing picture)" within the rectangle that defines the picture area.

PictureType

A value indicating how the graphic is stored:

0 (zero) PictureName$ is a file.

1 PictureName$ is an AutoText entry.

2 PictureName$ is a bookmark.

3 PictureName$ is ignored; the graphic is retrieved from the Clipboard.

4 PictureName$ is a PICT file stored in the resource fork of the template containing the macro (Macintosh only). You can use the ResEdit program to add PICT files to the resource fork of a template.


Example

In this example, the user selects a person's name from a list box and a picture of the person is displayed in the dialog box. The instructions assume that the graphics file to display is in the C:\PHOTOS folder and that the filename is the same as the selected name, followed by a .PIC filename extension. (On the Macintosh, change the instruction that sets the pictureName$ variable to use the value "HD:PHOTOS:" + name$.) The main subroutine that contains the dialog box definition is not shown.


Function dlgTest(identifier$, action, suppvalue)
Select Case action
Case 1                        'The dialog box is displayed
Case 2                        'The user selects a control
If identifier$ = "Name" Then
    name$ = DlgText$("Name")
    pictureName$ = "C:\PHOTOS\" + name$ + ".PIC"
    DlgSetPicture "Photo", pictureName$, 0
End If
Case 3                        'Text change (not applicable)
Case Else
End Select
End Function

See Also

Picture