如何在ms访问vba中使用.xls过滤msofiledialogsaveas

时间:2015-02-26 16:17:59

标签: vba access-vba

我使用下面的代码,我在msdn库中找到它。但是没有显示对话框 当我只使用Application.FileDialog(msoFileDialogSaveAs)withApplication.FileDialog(msoFileDialogSaveAs).Addfilter它给我的错误对象不支持这个属性

Sub Main()

'Declare a variable as a FileDialogFilters collection.
Dim fdfs As FileDialogFilters

'Declare a variable as a FileDialogFilter object.
Dim fdf As FileDialogFilter

'Set the FileDialogFilters collection variable to
'the FileDialogFilters collection of the SaveAs dialog box.
Set fdfs = Application.FileDialog(msoFileDialogSaveAs).Filters

'Iterate through the description and extensions of each
'default filter in the SaveAs dialog box.
For Each fdf In fdfs

    'Display the description of filters that include
    'Microsoft Excel files
    If InStr(1, fdf.Extensions, "xls", vbTextCompare) > 0 Then
        MsgBox "Description of filter: " & fdf.Description
    End If
Next fdf
End Sub

0 个答案:

没有答案