I need to embed an image to a spreadsheet via Excel VBA, such that whenever I relocate my excel file, the image will still show up. How can I do this?
This code will insert an image on the current sheet and position it at at cell E10:
Set oPic = Application.ActiveSheet.Shapes.AddPicture("d:\temp\mypic.jpg", False, True, 1, 1, 1, 1) oPic.ScaleHeight 1, True oPic.ScaleWidth 1, True oPic.Top = Range("E10").Top oPic.Left = Range("E10").Left