【问题标题】:MS Access FileDialog Filter doesn't work on original loadMS Access FileDialog 过滤器在原始负载上不起作用
【发布时间】:2016-07-15 23:24:17
【问题描述】:

我有以下脚本代码,过滤器和标题设置在我第一次运行代码时不起作用,但后续使用它。

有什么建议吗?

Set f = Application.FileDialog(msoFileDialogFilePicker)

If f.Show = True Then

With f
    .Title = "Choose Excel File(s) to Import"
    .Filters.Clear
    .Filters.Add "Excel Files", "*.xlsx"
    .AllowMultiSelect = True

    For Each varfile In .SelectedItems
        MsgBox "IMPORTING: " & varfile
        tblImport = varfile
        DoCmd.TransferSpreadsheet acImport, 10, "Parts", tblImport, True
    Next varfile
End With

【问题讨论】:

    标签: ms-access vba ms-access-2013


    【解决方案1】:

    在调用Show 方法之前设置FileDialog 属性。

    Set f = Application.FileDialog(msoFileDialogFilePicker)
    
    With f
        .Title = "Choose Excel File(s) to Import"
        .Filters.Clear
        .Filters.Add "Excel Files", "*.xlsx"
        .AllowMultiSelect = True
        If .Show = True Then
            For Each varfile In .SelectedItems
                MsgBox "IMPORTING: " & varfile
                tblImport = varfile
                DoCmd.TransferSpreadsheet acImport, 10, "Parts", tblImport, True
            Next varfile
        End If
    End With
    

    【讨论】:

      猜你喜欢
      • 2017-04-04
      • 1970-01-01
      • 2010-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多