¡¡

Ä«Å×°í¸®    ÆÄÀÏ, µð½ºÅ©, Æú´õ °ü·ÃÇÔ¼ö Á¶È¸:2707
 Á¦¸ñ   File Open dialog (for choosing file) -- example

******************************************************************************************************

  File Open dialog (for choosing file) -- example

******************************************************************************************************

Sub getFileName()

    ' Displays the Office File Open dialog to choose a file name

    ' for the current employee record.  If the user selects a file

    ' display it in the image control.

    Dim fileName As String

    Dim result As Integer

    With Application.FileDialog(msoFileDialogFilePicker)

        .Title = "Select Employee Picture"

        .Filters.Add "All Files", "*.*"

        .Filters.Add "JPEGs", "*.jpg"

        .Filters.Add "Bitmaps", "*.bmp"

        .FilterIndex = 3

        .AllowMultiSelect = False

        .InitialFileName = CurrentProject.path

        result = .Show

        If (result <> 0) Then

            fileName = Trim(.SelectedItems.Item(1))

            Me![ImagePath].Visible = True

            Me![ImagePath].SetFocus

            Me![ImagePath].Text = fileName

            Me![FirstName].SetFocus

            Me![ImagePath].Visible = False

        End If

    End With

End Sub