How to create custom links in the Application.FileDialog using VBA?
I am attempting to use the FileDialog construct in VBA to display a list of available files the user may want to open. I would like to also steer the user towards some common folders in which they typically will find the type of content they are looking for. So far I have come short on locating a method to place a link on the left side of the FileDialog box in which they could click to jump to a specific location.
I am hoping there is a means of doing this while calling the FileDialog methods like an example shown below where I have used the fd.AddLinkMethod "<path goes here>"
.
Private Function GetLocatio开发者_高级运维n() 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
Here is a screenshot of what I am attempting to accomplish?
Any pointers?
Thanks,
It should be do-able, but you will need to switch from the access filedialog, and use the Windows Common Dialog from the windows API. ( http://support.microsoft.com/kb/161286 ) Then there are a few ways to modify the links that are pointed out in this article ( http://www.makeuseof.com/tag/4-more-ways-to-customize-common-dialog-open-in-windows-xp/ ). Not the most elegant, but it should work. Goodluck!
精彩评论