Sub 列出檔案加入超連結()
'設定引用項目Microsoft Shell Controls And Automation (必要)
Dim mySh As Shell32.Shell
Dim myFolder As Shell32.Folder
Set mySh = CreateObject("shell.application")
Set myFolder = mySh.BrowseForFolder(0, "請指定資料夾", 0)
Columns("A").Clear
Columns("B").Clear
G = myFolder.Items.Item.Path
path1 = G & "\" & "*.*"
file1 = Dir(path1): r = 1
Do While file1 <> ""
Sheets("工作表1").Cells(r, 1) = file1
ActiveSheet.Hyperlinks.Add Anchor:=Cells(r, 2), Address:=G & "\" & file1, _
TextToDisplay:=G & "\" & file1
r = r + 1
file1 = Dir '取得下一個檔名
Loop
End Sub
Sub 列出檔案加入超連結()
G = InputBox("輸入路俓")
Columns("A").Clear
Columns("B").Clear
path1 = G & "\" & "*.*"
file1 = Dir(path1): r = 1
Do While file1 <> ""
Sheets("工作表1").Cells(r, 1) = file1
ActiveSheet.Hyperlinks.Add Anchor:=Cells(r, 2), Address:=G & "\" & file1, _
TextToDisplay:=G & "\" & file1
r = r + 1
file1 = Dir '取得下一個檔名
Loop
End Sub
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/) |