marcvanderpeet12
Member
I wrote the following code which aligns all the textboxes that I have selected to the right.
However if I have not selected anything it does not work and gives an error. I would like to include something so I get a pop up saying "Please select anything" in case I didnt select anything.
Any thoughts on how to do this?
Code:
Sub alignFunction(direction)
Dim oSel As ShapeRange
Set oSel = ActiveWindow.Selection.ShapeRange
With oSel
.TextFrame.TextRange.Paragraphs.ParagraphFormat.Alignment = direction
End With
End Sub
Sub AlignRight()
alignFunction (ppAlignRight)
End Sub
However if I have not selected anything it does not work and gives an error. I would like to include something so I get a pop up saying "Please select anything" in case I didnt select anything.
Any thoughts on how to do this?