A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
How does the code determines where to place the shape?
and what if I want to control in which cell or in which sheet the shape should go?
Code looks good, except the Debug.Print line, you don't need it.
The Shape is placed where you setup the R object, I assume that R is a Range object. So if you
Set R = Range("B3:F5")
or
Set R = Cells(7,12)
the shape is places exactly over this cell(s).
And if you want to place the Shape in another sheet use
Set Sh = Worksheets(2).Shapes.AddPicture( etc.
But as the cells might have other positions in that sheet, you must (should) refer to the cells in that sheet too:
With Worksheets("MySheet")
Set R = .Range("B3:F5")
Set Sh = .Shapes.AddPicture("E:\Accord\Airtel\Pics" & fol & " P" & Name _
& ".jpeg", msoFalse, msoTrue, R.Left, R.Top, R.Width, R.Height)
End With
Note the dot in front of Range and Shapes.
Andreas.