我在VBA有一個按鈕的點擊事件裏面寫當我點擊這個Access 2010中的一個代碼它給我的錯誤說「沒有定義用戶定義類型」這是我的代碼:access 2010 vba用戶定義的類型沒有用FileOpenDialog定義?
Private Sub cmdBrowse_Click()
Dim FileOpenDialog As FileDialog
Set FileOpenDialog = Application.FileDialog(msoFileDialogFilePicker)
Dim SelectedFile As Variant
Dim db As DAO.Database
Set db = CurrentDb
With FileOpenDialog
.AllowMultiSelect = False
.Title = "Select A File To Use As A Logo"
.Filters.Clear
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg;*.bmp;*.png"
.ButtonName = "Use This File"
If .Show = True Then
For Each SelectedFile In .SelectedItems
Dim LogoFile As String
LogoFile = SelectedFile
Dim barewabarayate As Recordset
Set barewabarayate = db.OpenRecordset("barewabarayate")
With barewabarayate
.Edit
barewabarayate.Fields("image_path") = LogoFile
barewabarayate.Update
End With
Next
End If
End With
End Sub
是否已經設置到Microsoft Office XX參考對象庫? – Fionnuala