|
如何定义msoFileDialogFilePicker
编译错误,变量未定义,明显显示加粗的那句代码,我该怎么改,我试过删除Option Explicit
还是出现同样错误
Option Compare Database
Option Explicit
Dim path As String
Sub getFileName()
' 显示一个 Office 打开文件对话框,为当前的雇员记录
' 选择一个文件名.如果用户选择了一个文件,
' 则将它显示到图片控件中
Dim fileName As String
Dim result As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "选择雇员照片"
.Filters.Add "所有文件", "*.*"
.Filters.Add "JPEGs", "*.jpg"
'.Filters.Add "位图文件", "*.bmp"
.FilterIndex = 1
.AllowMultiSelect = False
.InitialFileName = CurrentProject.path
result = .Show
If (result <> 0) Then
fileName = Trim(.SelectedItems.Item(1))
Me![照片路径].Visible = True
Me![照片路径].SetFocus
Me![照片路径].Text = fileName
' Me![姓氏].SetFocus
Me.下单日期.SetFocus
Me![照片路径].Visible = False
错误信息.Visible = False
End If
End With
End Sub |
|