Consulting

Results 1 to 2 of 2

Thread: Use VBA to group shapes in WORD on Mac

  1. #1
    VBAX Newbie
    Joined
    Oct 2017
    Location
    Essen, Germany
    Posts
    2
    Location

    Use VBA to group shapes in WORD on Mac

    Hi all,

    I'm trying to group two shapes (an image and its caption) in VBA on a Mac (Mac OS 10.13.2, Word 15.41)

    to test: Create an empty document, add an image (Normale shape, not inline) and a text box
    Sub GroupTwoBoxes()
    
    
    ActiveDocument.Shapes.Range(Array(ActiveDocument.Shapes(1).Name, ActiveDocument.Shapes(2).Name)).Select
    Selection.ShapeRange.Group
    
    
    End Sub
    When I run this script I get "runtime Error 9" The element with the given name does not exists.

    running the exact same code on Windows works as expected (also Word 15.41)

    Any Idea?

    or is this just another case of: "If it looks like a bug and quacks like a bug, chances are this is a bug"

    BR
    Yonz

  2. #2
    VBAX Newbie
    Joined
    Oct 2017
    Location
    Essen, Germany
    Posts
    2
    Location
    Hi all,

    There are many issues with the "old" object model (version 14.***) used by word for MAC. Microsoft have fixed this, and with the latest release (16.9, available [Jan 2018] via the Office Insider Program).

    Using the 16.9 Version of WORD on Mac most issues I had encountered are solved:
    1: Group Shapes
    2: Access to additional Properties, such as "AltText" and "Title"
    3: Assign a new name to a Shape

    One issue remains: When you copy / paste a shape (e.g. a picture) the name of the shape is copied as well. This implies that the <<Shape>>.name property is NOT unique, making it impossible to use the activedocument.shapes.range method to create a shaperange object, as it will fail with two duplicate objects in document.

Tags for this Thread

Posting Permissions

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