Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programatically narrow grouped shape width 1

Status
Not open for further replies.

Mumfy

Programmer
Mar 7, 2003
10
AU
Hi Everyone

I would appreciate any help to fix the following problem.

I am running Excel 97 on NT V4.0. I want to change the width of a grouped shape consisting of up to 22 perpendicular lines using the following code. This code works in Excel 2000 running on Windows 98 SE but does not work in Excel 97. No errors are produced, every statement works EXCEPT the width statement, shown in bold.

X has been set to the number of perpendicular lines, in this case, 22.
Code:
With Worksheets("Work")
  .Activate
  ActiveSheet.Shapes.Range(Array(X, X + 1, X + 2, X + 3, X + 4, X + 5, X + 6, X + 7, X + 8, X + 9, _
    X + 10, X + 11, X + 12, X + 13, X + 14, X + 15, X + 16, X + 17, X + 18, X + 19, _
    X + 20, X + 21)).Group.Select
  Selection.ShapeRange.LockAspectRatio = msoFalse
  Selection.ShapeRange.Height = 17.25
  [b]Selection.ShapeRange.Width = 33# [/b]
  Selection.ShapeRange.Rotation = 0#
End With
Where am I going wrong? Any suggestions would be greatly appreciated.

Thanks in anticipation, Mumfy.
 
Mumfy,

What are you trying to accomplish changing the shape range width & height for LINES?

THe ONLY property that you can effect are top & left. I executed your code several times in Excel 97, the only caveat being that the selection must be UNGROUPED before execution.

???

Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
Skip,

Thanks for your quick response.

The lines (up to 22) on the drawing layer form a shape that reflects some underlying data on the worksheet. However, the shape is too wide and I am trying to narrow it but NOT the individual lines. I am only setting the height to the initial value so this statement could now be left out. I am able to narrow the shape through the screen interface but not programatically. If I can do it through the screen interface, surely there is a way to do it programatically.

Hope this help to clarify what I am trying to accomplish.

I have grouped the lines to form a shape so that I can manipulate then together as a shape. I thought shapes had a width property that could be able to be set and therefore, adjust the shape's width.

I would appreciate any suggestions you have.

Thanks

Mumfy.
 
Hi Mumfy,

I wonder whether the '#' is the cause of your problem. When I resize a groupe object using the macro recorder, I get only the unit size without the '#', which I suspect only belongs to the rotation property.

Cheers
 
# is the TYPE of number. That's all.

Try ScaleWidth and ScaleHeight...
Code:
   Selection.ShapeRange.ScaleWidth 0.52, msoFalse, msoScaleFromTopLeft

Skip,

[glasses] [red]Be advised:[/red] It's been reported that a wee psychic is roaming the countryside.
Small Medium @ Large! [tongue]
 
Skip,

Thanks, your suggestion works perfectly and I don't need LockAspectRatio, Height or Rotation. A very elegant solution that deserves a star!

Thanks again

Mumfy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top