I want to use vba to insert photo into cell in excel for macbook

316 Views Asked by At

I want to use vba (macro) to insert a photo into a cell on the MacBook, but it is used well in Windows Excel, but it is not used in the MacBook. Is it because the path to load the photo file is different? Can I modify this vba to be usable on macbook? I'm getting an execution error in the bolded part of the code below.

Sub insert_Pic()


Dim Pic As Variant


***Pic = Application.GetOpenFilename(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif;*.png")***


If Pic = False Then Exit Sub


With ActiveSheet.Pictures.Insert(Pic).ShapeRange


.LockAspectRatio = msoFalse


.Height = Selection.Height - 4


.Width = Selection.Width - 4


.Left = Selection.Left + 2


.Top = Selection.Top + 2


End With


End Sub
0

There are 0 best solutions below