below macro, created by Rgonzo and Rorya batch inserts pictures in Column D. The network paths are located in Column C.
The macro works just fine. I am really happy with it. But there is one thing I would like to get adjusted. The graphics are not embedded but are linked to the correspoding file.
How has the macro to be adjusted so that the graphics get embedded?
I came across this code snippet in this respect but I guess is of no use in this case ...
' ActiveSheet.Shapes.AddPicture Filename:="C:\test\desert.jpg", linktofile:=msoFalse, _
' savewithdocument:=msoCTrue, Left:=0, Top:=0, Width:=100, Height:=100
Help is much appreciated. Thank you very much in advance.
' by Rgonzo and rorya
Dim c As Range
Dim Image As Picture
On Error Resume Next
For Each c In Range(Range("C2"), Range("C" & Rows.Count).End(xlUp))
Set Image = ActiveSheet.Pictures.Insert(c.Value2)
If .Height > Application.CentimetersToPoints(4) Then _
.ShapeRange.ScaleHeight Application.CentimetersToPoints(4) / .Height, msoCTrue
.TopLeftCell.RowHeight = Image.Height + 10
If .Height > .Width Then
.Rotation = 90
.IncrementLeft .Height / 2 - .Width / 2
.IncrementTop .Width / 2 - .Height / 2 + 5
.TopLeftCell.RowHeight = Image.Width + 10
Else: .ShapeRange.IncrementTop (5)