簡體   English   中英

使用VBA從Excel工作表中的列表中打開文件夾

[英]Open folder from list in Excel sheet using VBA

此代碼用於打開特定的文件夾。

Dim strFolderPath As String 
strFolderPath = “C:\temp\” 
ThisWorkbook.FollowHyperlink (strFolderPath)

我需要打開一個保存在Excel工作表中的文件夾(如下圖所示)。 我需要在Excel中讀取路徑並打開文件夾。

假設您在A到C的前三列中都有表格。您可以在單元格E1中寫入序列號並運行宏。 例如,如果您在單元格E1中輸入3並單擊按鈕,則來自Edres的文件夾將打開。

Dim strFolderPath As String
Dim NrRow As Long
NrRow = Cells(1, 5)
strFolderPath = Cells(NrRow + 1, 3).Value
ThisWorkbook.FollowHyperlink (strFolderPath)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM