Hello all!
Hoping somebody can help me here, I'm way beyond my knowledge base and out of my comfort zone with this problem!
I currently use a macro to insert pictures to a specific cell, when I click the assigned button, it opens the file browser, allows me to choose my picture, and then asks to select the cell I wish it to be fitted to, however this works fine until the document leaves my laptop where the pictures are only linked to, instead of being saved with the document.
I understand this problem is caused by newer versions of excel (circa 2013 onwards?) and that the solution is to change it from a picture insert to a shape insert as a picture, but I cannot get a macro to work with these commands because I do not fully understand them.
If somebody can guide me on this, that would be much appreciated, I have attached my code used currently below:
I believe it will then just be this part that needs changing?![]()
Sub PhotoInsert() Dim sFile As Variant, r As Range sFile = Application.GetOpenFilename(FileFilter:="Pic Files (*.jpg;*.bmp), *.jpg;*.bmp", Title:="Browse to select a picture") If sFile = False Then Exit Sub On Error Resume Next Set r = Application.InputBox("Click in the cell to hold the picture", Type:=8) On Error GoTo 0 If r Is Nothing Then Exit Sub If r.Count > 1 Then Exit Sub ActiveSheet.Pictures.Insert (sFile) With ActiveSheet.Shapes(ActiveSheet.Shapes.Count) .LockAspectRatio = False .Top = r.Top .Left = r.Left .Height = r.MergeArea.Height .Width = r.MergeArea.Width End With End Sub
![]()
ActiveSheet.Pictures.Insert (sFile) With ActiveSheet.Shapes(ActiveSheet.Shapes.Count) .LockAspectRatio = False .Top = r.Top .Left = r.Left .Height = r.MergeArea.Height .Width = r.MergeArea.Width End With End Sub
Bookmarks