Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Jul 2003
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search for AutoShapes (Word 2002)

    How can one Edit-Find or GoTo an AutoShape? GoTo 'Graphic' does not work. Edit find '^g' does not work. Can anybody help?
    Carol

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Search for AutoShapes (Word 2002)

    You could copy the following macro into a module in your Normal.dot or global template:

    Sub FindNextAutoShape()
    Dim lngNumShapes As Long
    Static lngCurShape As Long
    Dim i As Long
    lngNumShapes = ActiveDocument.Shapes.Count
    If lngCurShape >= lngNumShapes Then
    lngCurShape = 0
    End If
    For i = lngCurShape + 1 To lngNumShapes
    If ActiveDocument.Shapes(i).Type = msoAutoShape Then
    lngCurShape = i
    ActiveDocument.Shapes(i).Select
    Exit For
    End If
    Next i
    End Sub

    You can assign it to a custom toolbar button or keyboard shortcut for ease of use.

    Note: the macro selects the shapes in the order they were created, not necessarily in the order in which they occur in the document.

  3. #3
    Lounger
    Join Date
    Jul 2003
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search for AutoShapes (Word 2002)

    Thank you Hans. It works very well, except that it does not find any of the Line autoshapes. Can the code be adjusted somewhat to search for these shapes?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Search for AutoShapes (Word 2002)

    Here is a version that includes "general" autoshapes, callouts, freeform lines and lines/arrows. You can add items to the Case instruction (for example msoTextBox) or remove them as needed.

    Sub FindNextAutoShape()
    Dim lngNumShapes As Long
    Static lngCurShape As Long
    Dim i As Long
    lngNumShapes = ActiveDocument.Shapes.Count
    If lngCurShape >= lngNumShapes Then
    lngCurShape = 0
    End If
    For i = lngCurShape + 1 To lngNumShapes
    Select Case ActiveDocument.Shapes(i).Type
    Case msoAutoShape, msoCallout, msoFreeform, msoLine
    lngCurShape = i
    ActiveDocument.Shapes(i).Select
    Exit For
    End Select
    Next i
    End Sub

    To find out which types are available, type msoShapeType in the search box in the Object Browser.

  5. #5
    Lounger
    Join Date
    Jul 2003
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search for AutoShapes (Word 2002)

    Great, thank you very much. At the risk of being a real pest - is there any way to to make the screen show the currently selected AutoShape?
    Carol

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Search for AutoShapes (Word 2002)

    Yep, you only need to add one line:

    ActiveDocument.Shapes(i).Select
    ActiveWindow.ScrollIntoView ActiveDocument.Shapes(i)
    Exit For

  7. #7
    Lounger
    Join Date
    Jul 2003
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search for AutoShapes (Word 2002)

    It works! I knew someone in the Lounge would be able to help me. Thank you again.
    Carol

Posting Permissions

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