我试图创建一个打开文件对话框的按钮,然后让您选择要复制到数据库的文件夹中的图像。我一直在使用这段代码,但是我被困在了filecopy命令中,我似乎无法正确格式化它。我使用数据库的路径加几个文件夹,最后选择一个组合框来选择特定的文件夹来创建路径(这样,如果数据库被移动,组合框就会根据类别对组合框进行排序) 。这是我一直在使用的代码。多谢你们。MS-ACCESS通过文件对话框通过vba复制文件
Private Sub Command156_Click()
Dim fDialog As Office.FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim varFile As Variant
' Set up the File Dialog. '
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
fd.InitialFileName = [Application].[CurrentProject].[Path]
With fDialog
' Allow user to make multiple selections in dialog box '
.AllowMultiSelect = False
' Set the title of the dialog box. '
.Title = "Please select a Image"
' Clear out the current filters, and add our own.'
.Filters.Clear
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the '
' user picked at least one file. If the .Show method returns '
' False, the user clicked Cancel. '
If .Show = True Then
filecopy([.SelectedItems],[GetDBPath] & "\Images\Equipment\" & Combo153)
Else
End If
End With
End Sub
那么问题是/你的问题是什么? – JohnFx
删除括号'(','['和']',语法为'FileCopy SourceFile,DestinationFile' –