|
那就稍微改一下吧。照理应该可以的。- Sub main()
- Dim Fn$, Filename$, x$
- Set d = CreateObject("Scripting.Dictionary")
- Fn = Dir(ThisWorkbook.Path & "\*.JPG") '读取所有jpg文件,存入字典,key为文件首字符。
- x = Left(Fn, 1)
- d(x) = Fn
- Do While Fn <> ""
- Fn = Dir
- x = Left(Fn, 1)
- If Len(x) > 0 Then d(x) = IIf(d.exists(x), d(x) & "," & Fn, Fn)
- Loop
-
- Call 删除
- dk = d.keys
- For k = 0 To UBound(dk)
- x = dk(k)
- Sheets.Add after:=Sheets(Sheets.Count)
- xrr = Split(d(x), ",")
- With ActiveSheet
- .Name = x
- n = 0
- For i = 0 To UBound(xrr)
- Filename = ThisWorkbook.Path & "" & xrr(i)
- .Cells(2 * i + 1, 1).Select
- ActiveSheet.Pictures.Insert(Filename).Select
- .Cells(2 * i + 1, 1).RowHeight = Selection.ShapeRange.Height
- Next
- End With
- Next
- Sheets(1).Activate
- End Sub
复制代码 |
评分
-
查看全部评分
|