【问题标题】:How to create custom links in the Application.FileDialog using VBA?如何使用 VBA 在 Application.FileDialog 中创建自定义链接?
【发布时间】:2010-11-12 22:50:44
【问题描述】:

我正在尝试使用 VBA 中的 FileDialog 构造来显示用户可能想要打开的可用文件列表。我还想引导用户使用一些常见的文件夹,他们通常会在其中找到他们正在寻找的内容类型。到目前为止,我还没有找到一种方法来在 FileDialog 框的左侧放置一个链接,他们可以在其中单击以跳转到特定位置。

我希望在调用 FileDialog 方法时有一种方法可以做到这一点,如下所示,我使用了fd.AddLinkMethod "<path goes here>"

Private Function GetLocation() As String
     Dim fd As FileDialog
     Dim vrtSelectedItem As Variant
     Set fd = Application.FileDialog(msoFileDialogOpen)

     fd.ButtonName = "Open"
     fd.Title = "Select File To Open"
     fd.InitialView = msoFileDialogViewTiles

     fd.AddLinkMethod "<path goes here>"

     With fd
         If .Show = -1 Then

             For Each vrtSelectedItem In .SelectedItems
                 GetLocation= FormatPath(vrtSelectedItem)
             Next vrtSelectedItem

           End If
      End With     

      Set fd = Nothing
 End Function

这是我尝试完成的屏幕截图?

任何指针?

谢谢,

【问题讨论】:

    标签: ms-access vba dialog hyperlink openfiledialog


    【解决方案1】:

    它应该是可行的,但您需要从访问文件对话框切换,并使用 Windows API 中的 Windows 通用对话框。 (http://support.microsoft.com/kb/161286)然后有几种方法可以修改本文中指出的链接(http://www.makeuseof.com/tag/4-more-ways-to-customize-common-dialog-open-in-windows-xp/)。不是最优雅的,但它应该可以工作。祝你好运!

    【讨论】:

    • 感谢大卫修复我的链接
    猜你喜欢
    • 2017-09-21
    • 1970-01-01
    • 1970-01-01
    • 2012-08-10
    • 2014-09-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多