Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    May 2003
    Location
    Sydney, New South Wales, Australia
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Determining InlineShape or Shape (Eng/WordVBA/2000)

    Hi all,

    I need a macro to determine whether the selected object is an inline shape or a floating object-objects in question are typically either linked or inserted picture files or floating pictures.

    I can easily test for the floating object using the following:

    If Selection.Range() = Shape Then
    MsgBox "This is a Floating Shape"
    End if

    But I can't figure out how to test for an inline shape. My knowledge is too limited.

    Any help is appreciated.
    Thanks
    Greig.

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Determining InlineShape or Shape (Eng/WordVBA/2000)

    You might want to try something like
    If Selection.InlineShapes.count > 0 then
    MsgBox "You have at least one Inline Shape selected"
    End If
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    May 2003
    Location
    Sydney, New South Wales, Australia
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Determining InlineShape or Shape (Eng/WordVBA/2000)

    I have answered my own question and thought it appropriate to post it here for the benefits of others that may have similar queries. I didn't know about the constants(?) wdSelectionInlineShape and wdSelectionShape.

    Thank you Andrew for your reply, but this solution is perfect.

    Sub DetermineSelectedObject()

    If Selection.Type = wdSelectionInlineShape Then
    MsgBox "This is an Inline Shape"
    ElseIf Selection.Type = wdSelectionShape Then
    MsgBox "This is a Floating Shape"
    Else: MsgBox "You must select a valid Inline or Floating Shape"
    End If

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •