Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub Import_img()
- Dim path$, picpath$, sFile$, myPic As Object, ws As Worksheet, i%
- Set ws = ActiveSheet
- i = 1 ' first row
- col = 1 ' column
- path = "C:\images\" 'directory
- sFile = Dir$(path, vbNormal)
- Do Until LenB(sFile) = 0
- If sFile <> "." And sFile <> ".." Then
- picpath = path & sFile
- Set myPic = ws.Shapes.AddPicture(picpath, False, True, 0, 0, -1, -1)
- With myPic
- .Height = Cells(i, col).Height
- .Top = Cells(i, col).Top
- .Left = Cells(i, col).Left
- .Name = sFile
- End With
- i = i + 1
- End If
- sFile = Dir$
- Loop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement