unclebiff
08-06-2016, 11:59 AM
Hey everyone. I am trying to write a program that allows the user to define the space between two shapes. When I try to run the program I get an error that says "Method or Data Member Not Found" when I use .Group. I am relatively new to VBA but have experience working in the C++ environment. The code:
Sub Spacer()
Dim sel As GroupShapes
Dim TopShape As Shape
Dim BottomShape As Shape
Dim Space As Single
Dim x As Single
sel = ActiveWindow.Selection.ShapeRange(1).Group
If sel.Item(1) > sel.Item(2) Then
TopShape = sel.Item(1)
BottomShape = sel.Item(2)
Else
TopShape = sel.Item(2)
BottomShape = sel.Item(1)
End If
Space = TopShape.Height - BottomShape.Height
x = InputBox("Bottom Space:")
For i = Space To x
BottomShape.IncrementTop 1
i = TopShape.Height - BottomShape.Height
Next i
End Sub
Anyone have any ideas why the Group does not work? Also, if you have any other pointers or ideas, let me know!
Sub Spacer()
Dim sel As GroupShapes
Dim TopShape As Shape
Dim BottomShape As Shape
Dim Space As Single
Dim x As Single
sel = ActiveWindow.Selection.ShapeRange(1).Group
If sel.Item(1) > sel.Item(2) Then
TopShape = sel.Item(1)
BottomShape = sel.Item(2)
Else
TopShape = sel.Item(2)
BottomShape = sel.Item(1)
End If
Space = TopShape.Height - BottomShape.Height
x = InputBox("Bottom Space:")
For i = Space To x
BottomShape.IncrementTop 1
i = TopShape.Height - BottomShape.Height
Next i
End Sub
Anyone have any ideas why the Group does not work? Also, if you have any other pointers or ideas, let me know!