|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 批量导入文件()
Dim iNumber As Integer, DocName As String '定义iNumber是文件数量,DocName是所选文件的全名称(含路径)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Show
For iNumber = 1 To .SelectedItems.Count
DocName = .SelectedItems(iNumber)
ActiveSheet.OLEObjects.Add(Filename:= _
DocName, Link:=False, _
DisplayAsIcon:=True, IconFileName:= _
"C:\windows\Installer\{AC76BA86-1033-FFFF-7760-0E0F06755100}\_PDFFile.ico", _
IconIndex:=0, IconLabel:= _
DocName).Select
ActiveCell.Offset(1, 0).Range("A1").Select '每隔1个单元格往下放文件
Next iNumber
End With
'批量导入excel的图标"C:\windows\Installer\{90150000-0011-0000-0000-0000000FF1CE}\xlicons.exe", _
End Sub
|
评分
-
3
查看全部评分
-
|