- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-6-1 20:28 ½s¿è
¦^´_ 4# jaga0828
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim AR(), i As Integer, ii As Integer, fs As String, Rng As Range
- With ActiveSheet
- .Cells = ""
- .Pictures.Delete
- fs = Dir("D:\test\*.jpg")
- Do Until fs = ""
- ReDim Preserve AR(0 To i)
- AR(i) = fs '¹Ï¤ù¦WºÙ¸m¤J°}¦C
- fs = Dir
- i = i + 1
- Loop
- For i = 0 To UBound(AR) Step 2
- For ii = 0 To 1
- If ii + i <= UBound(AR) Then
- .Cells(Int(i / 2) + 1, 1 + (ii * 2)) = AR(ii + i)
- Set Rng = .Cells(Int(i / 2) + 1, 2 + (ii * 2))
- With .Pictures.Insert("D:\test\" & AR(ii + i))
- .Top = Rng.Top
- .Left = Rng.Left
- .Width = Rng.Width
- .Height = Rng.Height
- End With
- End If
- Next
- Next
- End With
- End Sub
½Æ»s¥N½X- Sub Ex_1()
- Dim f As Object, E As Object, Rng As Range, i As Integer
- Set f = CreateObject("Scripting.FileSystemObject").getfolder("D:\test").Files
- With ActiveSheet
- .Cells = ""
- .Pictures.Delete
- i = 1
- For Each E In f
- If LCase(E) Like "*.jpg" Then
- If i Mod 2 > 0 Then
- Set Rng = .Cells(Int(i / 2) + 1, 1)
- Else
- Set Rng = .Cells(i - Int(i / 2), 3)
- End If
- Rng.Value = E
- With .Pictures.Insert(E)
- .Top = Rng.Cells(1, 2).Top
- .Left = Rng.Cells(1, 2).Left
- .Width = Rng.Cells(1, 2).Width
- .Height = Rng.Cells(1, 2).Height
- End With
- i = i + 1
- End If
- Next
- End With
- End Sub
½Æ»s¥N½X |
|