【发布时间】: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