作者windknife18 (windknife18)
看板Office
標題Re: [算表] 是否能與檔案的摘要做連結
時間Wed Jun 10 17:05:30 2009
將之前看的文章修改一下,以下是VBA的程式,
使用方法請看精華區或之前的文章,
看看是不是你要的囉 ...
Sub ListDetails()
Dim arrHeaders(34)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "請選取資料夾", 0, 0)
Application.ScreenUpdating = False
If (Not objFolder Is Nothing) Then
'假如選桌面時........
On Error Resume Next
If IsError(objFolder.items.Item.Path) Then Exit Sub
On Error GoTo 0
ShellFolderName = objFolder.items.Item.Path
sFullPath = objFolder.items.Item.Path
Else
MsgBox "未選取資料夾": Exit Sub
End If
Set objFolder = objShell.Namespace(sFullPath)
Cells(1, 1) = objFolder.GetDetailsOf(objFolder.items, 0)
Cells(1, 2) = objFolder.GetDetailsOf(objFolder.items, 14)
j = 1
For Each strFileName In objFolder.items
j = j + 1
Cells(j, 1) = objFolder.GetDetailsOf(strFileName, 0)
Cells(j, 2) = objFolder.GetDetailsOf(strFileName, 14)
Next
Application.ScreenUpdating = True
End Sub
※ 引述《gillqoo》之銘言:
: 版本:office 2003
: 問題:
: 在每個檔案的右鍵->內容->摘要,裡面對檔案作編號(如下面連結圖)
: http://images.plurk.com/3440661_381dacc18a136472b1190421a61be040.jpg
: 再將所有的檔案在excel內做列表,檔案名稱部份做超連結,舉例如下:
: 檔名 編號
: A.doc CI-001
: B.xls CI-002
: 請問有沒有可能,
: 在編號那一欄可以隨著檔案裡摘要的編號更動而自己變動?謝謝
: ※ 編輯: gillqoo 來自: 140.134.30.92 (06/10 15:36)
: 推 windknife18:編號是取 前面的4碼 還是 CI假上後面的4碼呢? 06/10 16:10
: → gillqoo:編號是取"CI-XXX"這整串. 06/10 16:59
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.131.84.79
※ 編輯: windknife18 來自: 140.131.84.79 (06/10 17:08)
推 gillqoo:太感謝了~雖然不是我要問的問題,不過也幫了我一個大忙 06/11 10:52
→ gillqoo:我沒用過VBA不知道原來可以這樣用~醬整理資料快多了 06/11 10:53
推 gillqoo:請問若不想顯示資料夾的話,要怎麼改?謝謝 06/11 11:24
→ gillqoo:不好意思!有回答到我的問題,只是試驗時選到還沒編碼的檔案 06/11 11:25