PDA

View Full Version : Open Images Folder Mac OSX



Ilfalco87
12-21-2016, 08:02 AM
Hi all! I'm having issues converting this macro to be compatible with mac. Works flawless on Windows, but the openfile dialog is different on Mac. Tried numerous websites (not much to find). I hope anyone can help me out. I'm a novice in this. Thank you!!


Sub InsertPictures()

Dim PicList() As Variant
Dim PicFormat As String
Dim Rng As Range
Dim sShape As Shape
Dim a As Integer
Dim xColIndex As Integer
Dim xRowIndex As Integer


On Error Resume Next
PicList = Application.GetOpenFilename(PicFormat, MultiSelect:=True)
xColIndex = 40
xRowIndex = 14


a = 1




If IsArray(PicList) Then
For lLoop = LBound(PicList) To UBound(PicList)

Set Rng = Range(Worksheets("Report").Cells(xRowIndex, xColIndex), Worksheets("Report").Cells(xRowIndex + 9, xColIndex + 17))
Set sShape = ActiveSheet.Shapes.AddPicture(PicList(lLoop), msoFalse, msoCTrue, Rng.Left, Rng.Top, Rng.Width, Rng.Height)

If a Mod 2 = 0 Then
xColIndex = xColIndex - 18
xRowIndex = xRowIndex + 15
If a Mod 6 = 0 Then
xRowIndex = 14
xColIndex = xColIndex + 38
End If
Else
xColIndex = xColIndex + 18
End If

a = a + 1
Next
End If
End Sub