|
toddbckele 发表于 2015-6-8 15:50
这样做我不能做到全部提取呀 只能单个的提取。那样也不太好,太慢了呢。。不知道有没有其他办法 可以看看 ...
修改为:
Sheets(1).OLEObjects.Add Filename:=dir_name & strfilename, Link:=False, _
DisplayAsIcon:=True, IconFileName:="C:\Windows\system32\packager.dll", _
IconIndex:=0, IconLabel:=Sheets(1).Cells(n, 14)
试试看。- Sub add_link()
- On Error GoTo err_exit
- ' Range("A3:A65535").ClearContents
- Range("I3:I65535").ClearContents
- Range("J3:K65535").ClearContents
- Dim fd As FileDialog
- Set fd = Application.FileDialog(msoFileDialogFolderPicker)
- Dim vritem As Variant
- With fd
- If .Show = -1 Then
- i = 0
- For Each vritem In .SelectedItems
- i = i + 1
- dname = vritem
- Next vritem
- If i >= 2 Then
- MsgBox ("不能够选择多个文件夹,请重新选择")
- Exit Sub
- End If
- End If
- End With
- Set fd = Nothing
- dir_name = (dname & "")
- strfilename = Dir(dir_name)
- ' Dim obj As Object
- ' Set obj = Application.COMAddIns.Item("prjAddin.Office_Addin").Object '获取myEXCEL.net的编程接口
- J = 0
- n = 3
- Do While strfilename <> ""
- Sheets(1).Cells(n, 15) = strfilename
- Sheets(1).Cells(n, 14) = strfilename
- 'Sheets(1).Hyperlinks.Add Anchor:=Sheets(1).Cells(n, 14), Address:=dir_name & strfilename
- Sheets(1).OLEObjects.Add Filename:=dir_name & strfilename, Link:=False, _
- DisplayAsIcon:=True, IconFileName:="C:\Windows\system32\packager.dll", _
- IconIndex:=0, IconLabel:=Sheets(1).Cells(n, 14)
- n = n + 1
- J = J + 1
- strfilename = Dir
- Loop
- err_exit:
- Exit Sub
- End Sub
复制代码 |
|