Is Figure Inline or Floating?

J

Jon Borel

I'm trying to apply a grey line around any selected figure. Success seems to
be determined by if the figure is Inline or Floating. Rather than write two
macros and force my user to decide which one to run, I am hoping to make that
decision programmatically, but I can't figure out the correct syntax for the
conditional formatting. Any Suggestions?

If Selection IS INLINE Then

' Format it like this (Selection.InlineShapes.Borders)

ElseIF Selection is FLOATING Then

' Format it like this (Selection.ShapeRange.Line)

Else

MsgBox "Please Select a figure and try again.", vbOKOnly


Thanks,
Jon
 
J

Jay Freedman

The Selection.Type property returns one of 9 possible values (the members of the
WdSelectionType enumeration) to tell you what's selected. For your purposes, use

If Selection.Type = wdSelectionInlineShape Then
' Format it like this (Selection.InlineShapes.Borders)
ElseIf Selection.Type = wdSelectionShape Then
' Format it like this (Selection.ShapeRange.Line)
Else
MsgBox "Please select a figure and try again."
End If


--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all
may benefit.
 
J

Jon Borel

Works like a charm. You make it look so easy! Thanks for the solution and
even more for the explanation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top