【问题标题】:How to call GetOpenFileName? [duplicate]如何调用 GetOpenFileName? [复制]
【发布时间】:2017-04-04 06:47:12
【问题描述】:

我在 Access 数据库中有代码。

Private Sub Text0_Click()
    Dim s As String

    s = MyGetOpenFileName

    Me.Text0.Value = s
End Sub

在 Windows 7 Office 2010 中,当我单击打开的文本框时。

在 Windows 10 Office 2013 中没有任何反应。

【问题讨论】:

    标签: vba ms-access


    【解决方案1】:

    我认为这应该可行:

    将 OpenFile 调暗为工作簿

    fPath = Application.GetOpenFilename(FileFilter:="Excel files, *.xl; *.xlsx; *.xlsm; *.xlsb; *.xlam; *.xltx; *.xls; *.xlt ", Title:="You can type the title for Your window here")
    
    If fPath = False Then
        Exit Sub
    End If
    
    Set OpenedFile = Workbooks.Open(fileName:=fPath, UpdateLinks:=0, IgnoreReadOnlyRecommended:=True)
    

    我显示带有过滤器的窗口以显示 excel 文件,然后检查文件是否被选中,如果为真,然后我打开文件。

    【讨论】:

    • 对不起这个代码给我一个编译器错误(用户定义类型未定义)
    • 好的,我看到你的问题是用 Excel 标记的,所以我的代码是用于 excel vba。我认为访问数据库可能对这个主题有帮助:stackoverflow.com/questions/1091484/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-02
    相关资源
    最近更新 更多