Results 1 to 12 of 12

Shapes.Range(Array(...))

Threaded View

  1. #1
    Registered User
    Join Date
    11-01-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    6

    Shapes.Range(Array(...))

    We start with some Excel 2007 VBA to draw a shape of several parts, and to group those parts. Somewhat condensed for legibility, the code so far looks like:

    Set sh1 = .shapes.AddPolyline(...)
    Set sh2 = .shapes.AddShape(Type:=msoShapeRectangle, Left:=...)
    sh1.Name = "Part1"
    sh2.Name = "Part2"
    sh1.Fill.ForeColor.RGB = ...
    sh1.Line.Visible = msoFalse
    ...
    So far, so good.

    Then
    shapes.Range(Array("Part1", "Part2")).Group
    That works fine (even if I can't explain why it has a lower-case "s" on "shapes"). But then I run the code again and Excel reports
    > Run-time error '1004':
    > Grouping is disabled for the selected shapes.

    My guess is that Excel 2007 is attempting to group the first-made items with names "Part1" and "Part2", which are already part of a group. Hence the failure.

    Please, is it possible to specify the Shapes.Range(Array(...)) using the shape pointers (sh1 and sh2) rather than the names?

    Thank you.
    Last edited by jdaw1_SG; 11-03-2011 at 04:05 AM. Reason: shapes, range, array, name

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1