It's not clear how much experience you have. It is not as straightforward as you might imaging.
PPT only works in POINTS in code so a conversion function is needed
It is difficult to ensure the shapes are selected in the correct order so a sort routine is a good idea
Sub set_gap()
Dim sngGap As Single
Dim rayShapes() As Shape
Dim L As Long
On Error Resume Next
If ActiveWindow.Selection.ShapeRange.Count < 2 Then
MsgBox "Select at least 2 shapes"
Exit Sub
End If
On Error GoTo 0
ReDim rayShapes(1 To ActiveWindow.Selection.ShapeRange.Count)
sngGap = cm2Points(2) ' 2 cm gap
For L = 1 To ActiveWindow.Selection.ShapeRange.Count
Set rayShapes(L) = ActiveWindow.Selection.ShapeRange(L)
Next L
' make sure selected shapes are sorted by left value
Call SortByLeft(rayShapes)
' set the gap
For L = 2 To UBound(rayShapes)
Debug.Print rayShapes(L).Name
rayShapes(L).Left = rayShapes(L - 1).Left + rayShapes(L - 1).Width + sngGap
Next L
End Sub
Sub SortByLeft(Arrayin As Variant)
' sort the shapes based on their left value
Dim b_Cont As Boolean
Dim lngCount As Long
Dim vSwap As Shape
Do
b_Cont = False
For lngCount = LBound(Arrayin) To UBound(Arrayin) - 1
Debug.Print Arrayin(lngCount).Name
If Arrayin(lngCount).Left > Arrayin(lngCount + 1).Left Then
Set vSwap = Arrayin(lngCount)
Set Arrayin(lngCount) = Arrayin(lngCount + 1)
Set Arrayin(lngCount + 1) = vSwap
b_Cont = True
End If
Next lngCount
Loop Until Not b_Cont
'release objects
Set vSwap = Nothing
End Sub
Function cm2Points(inVal As Single) As Single
'convert cm to points
cm2Points = inVal * 28.346
End Function