2010-11-12 88 views
2

我正在嘗試使用VBA中的FileDialog構造來顯示用戶可能想要打開的可用文件的列表。我還想引導用戶找到一些常見的文件夾,他們通常會找到他們正在尋找的內容類型。到目前爲止,我找不到一個方法來在FileDialog框的左側放置一個鏈接,在這個框中可以點擊跳轉到特定的位置。如何使用VBA在Application.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 

這是我正試圖完成什麼的屏幕截圖?

alt text

任何指針?

感謝,

回答

相關問題