hi
pls help me to know that when i am trying to insert multiple pictures from a folder, am getting an run time error 1004, unable to get the insert property of the picture class. when click end picture is appearing in the cell and when clicking debug yellow color comes to the code "Set light_pic = ActiveSheet.Pictures.Insert(pic_location)"
i dont know how to fix the problem, pls help, thanks in advance
am using following vba code:
Private Sub CommandButton1_Click()
Dim light_pic As Picture
Dim pic_location As String
Dim light_name As String
For i = 17 To 21
light_name = Worksheets("Sheet1").Cells(i, 2).Value
pic_location = "C:\Users\SERVER\Desktop\Light pictures\" & Worksheets("Sheet1").Cells(i, 2).Value & ".jpg"
With Worksheets("Sheet1").Cells(i, 4)
Set light_pic = ActiveSheet.Pictures.Insert(pic_location)
light_pic.Top = .Top
light_pic.Left = .Left
light_pic.ShapeRange.LockAspectRatio = msoFalse
light_pic.Placement = xlMoveAndSize
light_pic.ShapeRange.Width = 90
light_pic.ShapeRange.Height = 80
End With
Next
Worksheets("Sheet1").Cells(1, 1).Select
End Sub
Private Sub Label1_Click()
End Sub
Regards
Rajesh
Bookmarks