Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

explicitly naming shapes, groups, etc, in macros for Word drawings?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mad Scientist Jr - 05 Dec 2005 16:54 GMT
see the macros below - paste these into a Word document

and run macro testDraw1 - it should work

a green blob dances around the screen

But try running the macro testDraw2

and you will see problems with lines like

ActiveDocument.Shapes("Line 5").Select

it seems when the line shape was created,

Word auto-enumerated some internal counter of that particular shape,
and auto-named the shape using that counter (ie "Line 5")

and if you try to play the macro later

that counter might be reset, and thus the shape name would be
different,

ie, what was "Line 5" when the macro was created, might be
"Line 2" for someone else playing back the macro.
and the macro won't work for playback

The answer would be to edit the macro to explicitly name the shape in a
line like

ActiveDocument.Shapes.AddShape(msoShapeOval, 86.25, 166.4, 61.85,
65.2). _
       Select

This also is the case with group objects, for instance "myGroup"

   ActiveDocument.Shapes.Range(Array("Oval 2", "Rectangle 3", "Line
4", _
       "Line 5" _
   , "Line 6", "Line 7")).Select
   Selection.ShapeRange.Group.Select

so that later you can reference it with

 ActiveDocument.Shapes("myGroup").Select

instead of some default name like

 ActiveDocument.Shapes("Group 8").Select

Can someone say how to explicitly name shapes and groups, in code such
as below? (Actual samples would be most helpful)

Thanks...

Public Declare Function GetTickCount Lib "kernel32.dll" () As Long

Sub subTimer(iMilliseconds As Integer)
   Dim iTickCount As Long
   DoEvents
   iTickCount = GetTickCount
   Do While (GetTickCount - iTickCount) < iMilliseconds
   Loop
   DoEvents
End Sub

Sub testDraw1()

   ActiveDocument.Shapes.AddShape(msoShapeOval, 98.5, 205.8, 58.4,
59.1). _
       Select
   Application.WindowState = wdWindowStateMaximize
   Selection.ShapeRange.Fill.Visible = msoTrue
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.ForeColor.RGB = RGB(0, 128, 0)
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 98.6
   Selection.ShapeRange.Top = 205.9
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph

   Call subTimer(100)

   Selection.ShapeRange.Left = InchesToPoints(0.12)
   Selection.ShapeRange.Top = InchesToPoints(1.86)

   Call subTimer(100)

   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 16.3
   Selection.ShapeRange.IncrementTop 1.4

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 12.95

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 15.6
   Selection.ShapeRange.IncrementTop 2.05

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 14.3

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 33.25
   Selection.ShapeRange.IncrementTop 6.8

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 29.2
   Selection.ShapeRange.IncrementTop 3.4

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 29.2
   Selection.ShapeRange.IncrementTop -1.4

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 45.5
   Selection.ShapeRange.IncrementTop -4.05

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 38.05
   Selection.ShapeRange.IncrementTop -6.1

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 46.9
   Selection.ShapeRange.IncrementTop -16.3

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 31.2
   Selection.ShapeRange.IncrementTop -33.3

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 34.65
   Selection.ShapeRange.IncrementTop -50.95

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 14.25
   Selection.ShapeRange.IncrementTop -32.6

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -53#
   Selection.ShapeRange.IncrementTop -13.55

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -70.65
   Selection.ShapeRange.IncrementTop -10.2

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -64.55
   Selection.ShapeRange.IncrementTop 43.5

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -56.35
   Selection.ShapeRange.IncrementTop 51.65

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -68.6
   Selection.ShapeRange.IncrementTop 5.4

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -61.85
   Selection.ShapeRange.IncrementTop -40.8

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -1.35
   Selection.ShapeRange.IncrementTop -41.4

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 53.65
   Selection.ShapeRange.IncrementTop -12.9

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 57.05
   Selection.ShapeRange.IncrementTop 10.2

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 38.75
   Selection.ShapeRange.IncrementTop 42.1

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 14.9
   Selection.ShapeRange.IncrementTop 36#

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft 2.05
   Selection.ShapeRange.IncrementTop 48.95

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -20.35
   Selection.ShapeRange.IncrementTop 57.7

   Call subTimer(100)

   Selection.ShapeRange.ScaleHeight 2.07, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 1.47, msoFalse,
msoScaleFromBottomRight

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -36.65
   Selection.ShapeRange.IncrementTop -2.7

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -42.15
   Selection.ShapeRange.IncrementTop -10.85

   Call subTimer(100)

   Selection.ShapeRange.IncrementLeft -11.55
   Selection.ShapeRange.IncrementTop -37.35

   Call subTimer(100)

   Selection.ShapeRange.ScaleWidth 1.21, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 1.33, msoFalse,
msoScaleFromBottomRight

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 36#
   Selection.ShapeRange.IncrementTop -35.3

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 34.65
   Selection.ShapeRange.IncrementTop -17.7

   Call subTimer(100)

   Selection.ShapeRange.ScaleWidth 1.61, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.06, msoFalse,
msoScaleFromBottomRight

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 86.25
   Selection.ShapeRange.IncrementTop 4.1

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 46.2
   Selection.ShapeRange.IncrementTop -28.55

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 46.85
   Selection.ShapeRange.IncrementTop -8.8

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 38.7
   Selection.ShapeRange.IncrementTop 45.5

   Call subTimer(100)
   Selection.ShapeRange.ScaleWidth 1.26, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.5, msoFalse, msoScaleFromTopLeft

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft -30.6
   Selection.ShapeRange.IncrementTop 57.7

   Call subTimer(100)
   Selection.ShapeRange.ScaleWidth 1.23, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 1.07, msoFalse,
msoScaleFromTopLeft

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft -71.35
   Selection.ShapeRange.IncrementTop 89#

   Call subTimer(100)
   Selection.ShapeRange.ScaleWidth 1.49, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 1.13, msoFalse,
msoScaleFromBottomRight

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft -31.9
   Selection.ShapeRange.IncrementTop -111.4

   Call subTimer(100)
   Selection.ShapeRange.ScaleWidth 1.07, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.15, msoFalse,
msoScaleFromBottomRight

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 52.95
   Selection.ShapeRange.IncrementTop -44.85

   Call subTimer(100)
   Selection.ShapeRange.ScaleHeight 1.13, msoFalse,
msoScaleFromTopLeft

   Call subTimer(100)
   Selection.ShapeRange.IncrementLeft 57.7
   Selection.ShapeRange.IncrementTop 104.6

   Call subTimer(100)
   Selection.ShapeRange.ScaleWidth 1.34, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.14, msoFalse,
msoScaleFromBottomRight

End Sub

Sub testDraw2()
   ActiveDocument.Shapes.AddShape(msoShapeOval, 86.25, 166.4, 61.85,
65.2). _
       Select
   Selection.ShapeRange.Fill.Visible = msoTrue
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 86.4
   Selection.ShapeRange.Top = 166.3
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(-0.05)
   Selection.ShapeRange.Top = InchesToPoints(1.31)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4
   ActiveDocument.Shapes.AddShape(msoShapeRectangle, 103.25, 235#,
29.9, _
       61.85).Select
   Selection.ShapeRange.Fill.Visible = msoTrue
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.ForeColor.RGB = RGB(51, 102, 255)
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 102.95
   Selection.ShapeRange.Top = 234.7
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.18)
   Selection.ShapeRange.Top = InchesToPoints(2.26)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4
   ActiveDocument.Shapes.AddLine(105.3, 298.85, 105.3, 349.15).Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 105.1
   Selection.ShapeRange.Top = 298.8
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.21)
   Selection.ShapeRange.Top = InchesToPoints(3.15)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4
   ActiveDocument.Shapes.AddLine(131.1, 299.55, 131.1, 349.15).Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 6#
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 131#
   Selection.ShapeRange.Top = 299.5
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.57)
   Selection.ShapeRange.Top = InchesToPoints(3.16)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4
   ActiveDocument.Shapes.AddLine(78.1, 237.05, 101.2, 254.7).Select
   Selection.ShapeRange.Flip msoFlipHorizontal
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 77.75
   Selection.ShapeRange.Top = 236.85
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(-0.17)
   Selection.ShapeRange.Top = InchesToPoints(2.29)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4
   ActiveDocument.Shapes("Line 5").Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 131#
   Selection.ShapeRange.Top = 299.5
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.57)
   Selection.ShapeRange.Top = InchesToPoints(3.16)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4
   ActiveDocument.Shapes.AddLine(135.15, 236.4, 156.9, 258.1).Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 135.35
   Selection.ShapeRange.Top = 236.15
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.63)
   Selection.ShapeRange.Top = InchesToPoints(2.28)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4
   ActiveDocument.Shapes.Range(Array("Oval 2", "Rectangle 3", "Line
4", _
       "Line 5" _
   , "Line 6", "Line 7")).Select
   Selection.ShapeRange.Group.Select
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 33.3
   Selection.ShapeRange.IncrementTop -34.65
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 25.15
   Selection.ShapeRange.IncrementTop -20.35
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 43.45
   Selection.ShapeRange.IncrementTop -26.5
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 30.55
   Selection.ShapeRange.IncrementTop -6.1
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 30.55
   Selection.ShapeRange.IncrementTop 4.05
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 12.2
   Selection.ShapeRange.IncrementTop 17.65
   Selection.ShapeRange.ScaleWidth 1.16, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.13, msoFalse,
msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 29.9
   Selection.ShapeRange.IncrementTop 25.1
   Selection.ShapeRange.ScaleWidth 1.41, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.16, msoFalse,
msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 20.35
   Selection.ShapeRange.IncrementTop 36#
   Selection.ShapeRange.ScaleWidth 1.08, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.1, msoFalse, msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 4.75
   Selection.ShapeRange.IncrementTop 27.85
   Selection.ShapeRange.IncrementRotation 5.24
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -19.05
   Selection.ShapeRange.IncrementTop 26.5
   Selection.ShapeRange.IncrementRotation 9.28
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -48.2
   Selection.ShapeRange.IncrementTop 8.8
   Selection.ShapeRange.IncrementRotation 8.64
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -31.25
   Selection.ShapeRange.IncrementTop -9.55
   Selection.ShapeRange.IncrementRotation 7.08
   Selection.ShapeRange.ScaleWidth 0.84, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 0.91, msoFalse,
msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -36#
   Selection.ShapeRange.IncrementTop -42.8
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementRotation 17.49
   ActiveDocument.Shapes("Group 8").Select
   ActiveDocument.Shapes("Group 8").Select
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.89, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.66, msoFalse, msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 23.1
   Selection.ShapeRange.IncrementTop -38#
   Selection.ShapeRange.IncrementRotation 18.79
   Selection.ShapeRange.ScaleHeight 0.83, msoFalse,
msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 10.2
   Selection.ShapeRange.IncrementTop 19#
   Selection.ShapeRange.IncrementRotation 9.53
   Selection.ShapeRange.ScaleHeight 0.77, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.68, msoFalse, msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 17#
   Selection.ShapeRange.IncrementTop 29.9
   Selection.ShapeRange.IncrementRotation 19.14
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -6.75
   Selection.ShapeRange.IncrementTop 19.05
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.76, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.67, msoFalse,
msoScaleFromBottomRight
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -37.35
   Selection.ShapeRange.IncrementTop 20.35
   Selection.ShapeRange.IncrementRotation 37.2
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.87, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.68, msoFalse,
msoScaleFromBottomRight
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -22.4
   Selection.ShapeRange.IncrementTop -15.6
   Selection.ShapeRange.ScaleHeight 0.79, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 1.36, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.IncrementRotation 13.49
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 11.55
   Selection.ShapeRange.IncrementTop -11.55
   Selection.ShapeRange.IncrementRotation 21.12
   Selection.ShapeRange.ScaleWidth 0.67, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.61, msoFalse,
msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -7.5
   Selection.ShapeRange.IncrementTop -4.75
   Selection.ShapeRange.IncrementRotation 16.34
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleWidth 0.72, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.79, msoFalse,
msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -5.45
   Selection.ShapeRange.IncrementTop -7.45
   Selection.ShapeRange.IncrementRotation 18.06
   ActiveDocument.Shapes("Group 8").Select
   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleWidth 0.71, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.8, msoFalse, msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
End Sub
Tony Jollans - 05 Dec 2005 18:19 GMT
I haven't read your code but to name shapes you can do something along these
lines ..

With ActiveDocument.Shapes.AddShape(msoShapeOval, 86.25, 166.4, 61.85,65.2)
   .Name = "myOval"
End With

or set a reference, after which you can use the reference any way you like
...

Set myOval = ActiveDocument.Shapes.AddShape(msoShapeOval, 86.25, 166.4,
61.85,65.2)

--
Enjoy,
Tony

> see the macros below - paste these into a Word document
>
[quoted text clipped - 754 lines]
>     ActiveDocument.Shapes("Group 8").Select
> End Sub
Mad Scientist Jr - 05 Dec 2005 20:07 GMT
I got it working - but for recording on the fly, I am wondering how you
can control what the default numbering of the shapes is. For instance,
I closed Word then opened it anew and clicked [record macro]. Then I
drew some shapes and stopped recording. See "test1" below. Then I
recorded a 2nd macro ("test2" below) and simply selected the shapes.

My question - what controls how they are named? there is "Oval 2" ,
"Rectangle 3", "Autoshape 4", "Line 5". Assuming no matter what the
shape is, it just gets a consectuive number, why did the numbering
start at 2?

Is there any way to control (from code or another macro) where this
numbering begins? ie

set myNumberBase = 1

?

PS working drawing code follows -

Public Declare Function GetTickCount Lib "kernel32.dll" () As Long

Sub subTimer(iMilliseconds As Integer)
   Dim iTickCount As Long
   DoEvents
   iTickCount = GetTickCount
   Do While (GetTickCount - iTickCount) < iMilliseconds
   Loop
   DoEvents
End Sub

Sub testDraw2()
   Dim oShape As Shape
   Dim oShapeRange As ShapeRange

   Set oShape = ActiveDocument.Shapes.AddShape(msoShapeOval, 86.25,
166.4, 61.85, 65.2)
   oShape.Select
   oShape.Name = "Oval 1"
   Selection.ShapeRange.Fill.Visible = msoTrue
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 86.4
   Selection.ShapeRange.Top = 166.3
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(-0.05)
   Selection.ShapeRange.Top = InchesToPoints(1.31)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddShape(msoShapeRectangle,
103.25, 235#, 29.9, 61.85)
   oShape.Name = "Rect 1"
   oShape.Select
   Selection.ShapeRange.Fill.Visible = msoTrue
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.ForeColor.RGB = RGB(51, 102, 255)
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 102.95
   Selection.ShapeRange.Top = 234.7
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.18)
   Selection.ShapeRange.Top = InchesToPoints(2.26)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(105.3, 298.85, 105.3,
349.15)
   oShape.Name = "Line 1"
   oShape.Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 105.1
   Selection.ShapeRange.Top = 298.8
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.21)
   Selection.ShapeRange.Top = InchesToPoints(3.15)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(131.1, 299.55, 131.1,
349.15)
   oShape.Name = "Line 2"
   oShape.Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 6#
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 131#
   Selection.ShapeRange.Top = 299.5
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.57)
   Selection.ShapeRange.Top = InchesToPoints(3.16)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(78.1, 237.05, 101.2,
254.7)
   oShape.Name = "Line 3"
   oShape.Select
   Selection.ShapeRange.Flip msoFlipHorizontal
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 77.75
   Selection.ShapeRange.Top = 236.85
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(-0.17)
   Selection.ShapeRange.Top = InchesToPoints(2.29)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   ActiveDocument.Shapes("Line 2").Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 131#
   Selection.ShapeRange.Top = 299.5
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.57)
   Selection.ShapeRange.Top = InchesToPoints(3.16)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(135.15, 236.4, 156.9,
258.1)
   oShape.Name = "Line 4"
   oShape.Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 135.35
   Selection.ShapeRange.Top = 236.15
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.63)
   Selection.ShapeRange.Top = InchesToPoints(2.28)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.Range(Array("Oval 1", "Rect 1",
"Line 1", "Line 2", "Line 3", "Line 4")).Group
   oShape.Select
   'Selection.ShapeRange.Group.Select
   oShape.Name = "Group 8"

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 33.3
   Selection.ShapeRange.IncrementTop -34.65
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 25.15
   Selection.ShapeRange.IncrementTop -20.35
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 43.45
   Selection.ShapeRange.IncrementTop -26.5
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 30.55
   Selection.ShapeRange.IncrementTop -6.1
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 30.55
   Selection.ShapeRange.IncrementTop 4.05
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 12.2
   Selection.ShapeRange.IncrementTop 17.65
   Selection.ShapeRange.ScaleWidth 1.16, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.13, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 29.9
   Selection.ShapeRange.IncrementTop 25.1
   Selection.ShapeRange.ScaleWidth 1.41, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.16, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 20.35
   Selection.ShapeRange.IncrementTop 36#
   Selection.ShapeRange.ScaleWidth 1.08, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.1, msoFalse, msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 4.75
   Selection.ShapeRange.IncrementTop 27.85
   Selection.ShapeRange.IncrementRotation 5.24
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -19.05
   Selection.ShapeRange.IncrementTop 26.5
   Selection.ShapeRange.IncrementRotation 9.28
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -48.2
   Selection.ShapeRange.IncrementTop 8.8
   Selection.ShapeRange.IncrementRotation 8.64
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -31.25
   Selection.ShapeRange.IncrementTop -9.55
   Selection.ShapeRange.IncrementRotation 7.08
   Selection.ShapeRange.ScaleWidth 0.84, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 0.91, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -36#
   Selection.ShapeRange.IncrementTop -42.8
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementRotation 17.49
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.89, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.66, msoFalse, msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 23.1
   Selection.ShapeRange.IncrementTop -38#
   Selection.ShapeRange.IncrementRotation 18.79
   Selection.ShapeRange.ScaleHeight 0.83, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 10.2
   Selection.ShapeRange.IncrementTop 19#
   Selection.ShapeRange.IncrementRotation 9.53
   Selection.ShapeRange.ScaleHeight 0.77, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.68, msoFalse, msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 17#
   Selection.ShapeRange.IncrementTop 29.9
   Selection.ShapeRange.IncrementRotation 19.14
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -6.75
   Selection.ShapeRange.IncrementTop 19.05
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.76, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.67, msoFalse,
msoScaleFromBottomRight
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -37.35
   Selection.ShapeRange.IncrementTop 20.35
   Selection.ShapeRange.IncrementRotation 37.2
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.87, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.68, msoFalse,
msoScaleFromBottomRight
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -22.4
   Selection.ShapeRange.IncrementTop -15.6
   Selection.ShapeRange.ScaleHeight 0.79, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 1.36, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.IncrementRotation 13.49
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 11.55
   Selection.ShapeRange.IncrementTop -11.55
   Selection.ShapeRange.IncrementRotation 21.12
   Selection.ShapeRange.ScaleWidth 0.67, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.61, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -7.5
   Selection.ShapeRange.IncrementTop -4.75
   Selection.ShapeRange.IncrementRotation 16.34
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleWidth 0.72, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.79, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -5.45
   Selection.ShapeRange.IncrementTop -7.45
   Selection.ShapeRange.IncrementRotation 18.06
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleWidth 0.71, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.8, msoFalse, msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
End Sub

Sub test()
'
' test1 Macro
' Macro recorded 12/5/2005 by User
'
   ActiveDocument.Shapes.AddShape(msoShapeOval, 36#, 125.65, 42.1,
29.2). _
       Select
   ActiveDocument.Shapes.AddShape(msoShapeRectangle, 152.85, 241.8,
36.65, _
       87.65).Select
   ActiveDocument.Shapes.AddShape(msoShapeRoundedRectangle, 286.65,
237.75, _
       48.9, 41.4).Select
   ActiveDocument.Shapes.AddLine(111.4, 364.1, 158.95, 406.85).Select
End Sub

Sub test2()
'
' test2 Macro
' Macro recorded 12/5/2005 by User
'
   ActiveDocument.Shapes("Oval 2").Select
   ActiveDocument.Shapes("Rectangle 3").Select
   ActiveDocument.Shapes("AutoShape 4").Select
   ActiveDocument.Shapes("Line 5").Select
End Sub

> I haven't read your code but to name shapes you can do something along these
> lines ..
[quoted text clipped - 771 lines]
> >     ActiveDocument.Shapes("Group 8").Select
> > End Sub
Mad Scientist Jr - 05 Dec 2005 20:09 GMT
Furthermore, would it be difficult to write a utility to convert such a
drawing macro to a Flash FLA or SWF file?

> I got it working - but for recording on the fly, I am wondering how you
> can control what the default numbering of the shapes is. For instance,
[quoted text clipped - 1316 lines]
> > >     ActiveDocument.Shapes("Group 8").Select
> > > End Sub
Tony Jollans - 05 Dec 2005 20:26 GMT
'fraid I can't answer either question.

I don't know what controls Word's auto naming process and I don't think
there's anything exposed to enable any sort of querying, let alone setting,
of it.

As for Flash - I haven't got a clue, sorry.

--
Enjoy,
Tony

> Furthermore, would it be difficult to write a utility to convert such a
> drawing macro to a Flash FLA or SWF file?
[quoted text clipped - 1319 lines]
> > > >     ActiveDocument.Shapes("Group 8").Select
> > > > End Sub
Steve Rindsberg - 06 Dec 2005 02:31 GMT
> Is there any way to control (from code or another macro) where this
> numbering begins? ie

I don't think so, but what's the difference if you can re-name the shape
anything you like at the time it's created?  

AAMOF, it's weirder than it looks on the surface if the drawing implementation
is anything like it is in PPT.

The shape has a name assigned when it's created.
It also gets its .Name property set to the name the shape is given at birth.

You can change the .Name property but not the actual name of the shape.

Most of the time it doesn't matter.  The .Name property is enough.

Signature

--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com

================================================
Mad Scientist Jr - 23 Dec 2005 16:16 GMT
> I don't think so, but what's the difference if you can re-name the shape
> anything you like at the time it's created?

My purpose is, record a macro, and then draw stuff on the screen, move
it around, etc, like an animated flash cartoon, then stop recording and
then you have a word macro that is like a flash animation. The only
tweaking of the code necessary should be adding a timer (250 ms or so)
inbetween frames. However, because Word doesn't explicitly set the
object names in the macro code when you record a macro and create new
objects, your macro won't play back, because it uses its own object
counter when naming objects. If you send it to another user or open a
new Word session and try to run the macro as is, it often won't work. I
fixed the code below to name the objects explicitly so you can see what
the animation looks like.

If it was possible to get Word's (or Powerpoint etc) macro recorder to
explicitly name the objects, you wouldn't need special software or
skills like Flash to create animations, only Office.

Try pasting this code in a Word doc and running macro testDraw2:

Public Declare Function GetTickCount Lib "kernel32.dll" () As Long

Sub subTimer(iMilliseconds As Integer)
   Dim iTickCount As Long
   DoEvents
   iTickCount = GetTickCount
   Do While (GetTickCount - iTickCount) < iMilliseconds
   Loop
   DoEvents
End Sub

Sub testDraw2()
   Dim oShape As Shape
   Dim oShapeRange As ShapeRange

   Set oShape = ActiveDocument.Shapes.AddShape(msoShapeOval, 86.25,
166.4, 61.85, 65.2)
   oShape.Select
   oShape.Name = "Oval 1"
   Selection.ShapeRange.Fill.Visible = msoTrue
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 86.4
   Selection.ShapeRange.Top = 166.3
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(-0.05)
   Selection.ShapeRange.Top = InchesToPoints(1.31)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddShape(msoShapeRectangle,
103.25, 235#, 29.9, 61.85)
   oShape.Name = "Rect 1"
   oShape.Select
   Selection.ShapeRange.Fill.Visible = msoTrue
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.ForeColor.RGB = RGB(51, 102, 255)
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 102.95
   Selection.ShapeRange.Top = 234.7
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.18)
   Selection.ShapeRange.Top = InchesToPoints(2.26)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(105.3, 298.85, 105.3,
349.15)
   oShape.Name = "Line 1"
   oShape.Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 105.1
   Selection.ShapeRange.Top = 298.8
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.21)
   Selection.ShapeRange.Top = InchesToPoints(3.15)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(131.1, 299.55, 131.1,
349.15)
   oShape.Name = "Line 2"
   oShape.Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 6#
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 131#
   Selection.ShapeRange.Top = 299.5
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.57)
   Selection.ShapeRange.Top = InchesToPoints(3.16)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(78.1, 237.05, 101.2,
254.7)
   oShape.Name = "Line 3"
   oShape.Select
   Selection.ShapeRange.Flip msoFlipHorizontal
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 77.75
   Selection.ShapeRange.Top = 236.85
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(-0.17)
   Selection.ShapeRange.Top = InchesToPoints(2.29)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   ActiveDocument.Shapes("Line 2").Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 131#
   Selection.ShapeRange.Top = 299.5
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.57)
   Selection.ShapeRange.Top = InchesToPoints(3.16)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.AddLine(135.15, 236.4, 156.9,
258.1)
   oShape.Name = "Line 4"
   oShape.Select
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 4.5
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 255)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.Line.BeginArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.BeginArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.Line.EndArrowheadLength =
msoArrowheadLengthMedium
   Selection.ShapeRange.Line.EndArrowheadWidth =
msoArrowheadWidthMedium
   Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Rotation = 0#
   Selection.ShapeRange.Left = 135.35
   Selection.ShapeRange.Top = 236.15
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionParagraph
   Selection.ShapeRange.Left = InchesToPoints(0.63)
   Selection.ShapeRange.Top = InchesToPoints(2.28)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.LayoutInCell = True
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight =
InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = 3
   Selection.ShapeRange.ZOrder 4

   Set oShape = ActiveDocument.Shapes.Range(Array("Oval 1", "Rect 1",
"Line 1", "Line 2", "Line 3", "Line 4")).Group
   oShape.Select
   'Selection.ShapeRange.Group.Select
   oShape.Name = "Group 8"

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 33.3
   Selection.ShapeRange.IncrementTop -34.65
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 25.15
   Selection.ShapeRange.IncrementTop -20.35
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 43.45
   Selection.ShapeRange.IncrementTop -26.5
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 30.55
   Selection.ShapeRange.IncrementTop -6.1
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 30.55
   Selection.ShapeRange.IncrementTop 4.05
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 12.2
   Selection.ShapeRange.IncrementTop 17.65
   Selection.ShapeRange.ScaleWidth 1.16, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.13, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 29.9
   Selection.ShapeRange.IncrementTop 25.1
   Selection.ShapeRange.ScaleWidth 1.41, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.16, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 20.35
   Selection.ShapeRange.IncrementTop 36#
   Selection.ShapeRange.ScaleWidth 1.08, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 1.1, msoFalse, msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 4.75
   Selection.ShapeRange.IncrementTop 27.85
   Selection.ShapeRange.IncrementRotation 5.24
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -19.05
   Selection.ShapeRange.IncrementTop 26.5
   Selection.ShapeRange.IncrementRotation 9.28
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -48.2
   Selection.ShapeRange.IncrementTop 8.8
   Selection.ShapeRange.IncrementRotation 8.64
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -31.25
   Selection.ShapeRange.IncrementTop -9.55
   Selection.ShapeRange.IncrementRotation 7.08
   Selection.ShapeRange.ScaleWidth 0.84, msoFalse, msoScaleFromTopLeft
   Selection.ShapeRange.ScaleHeight 0.91, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -36#
   Selection.ShapeRange.IncrementTop -42.8
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementRotation 17.49
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.89, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.66, msoFalse, msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 23.1
   Selection.ShapeRange.IncrementTop -38#
   Selection.ShapeRange.IncrementRotation 18.79
   Selection.ShapeRange.ScaleHeight 0.83, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 10.2
   Selection.ShapeRange.IncrementTop 19#
   Selection.ShapeRange.IncrementRotation 9.53
   Selection.ShapeRange.ScaleHeight 0.77, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.68, msoFalse, msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 17#
   Selection.ShapeRange.IncrementTop 29.9
   Selection.ShapeRange.IncrementRotation 19.14
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -6.75
   Selection.ShapeRange.IncrementTop 19.05
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.76, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.67, msoFalse,
msoScaleFromBottomRight
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -37.35
   Selection.ShapeRange.IncrementTop 20.35
   Selection.ShapeRange.IncrementRotation 37.2
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleHeight 0.87, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 0.68, msoFalse,
msoScaleFromBottomRight
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -22.4
   Selection.ShapeRange.IncrementTop -15.6
   Selection.ShapeRange.ScaleHeight 0.79, msoFalse,
msoScaleFromTopLeft
   Selection.ShapeRange.ScaleWidth 1.36, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.IncrementRotation 13.49
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft 11.55
   Selection.ShapeRange.IncrementTop -11.55
   Selection.ShapeRange.IncrementRotation 21.12
   Selection.ShapeRange.ScaleWidth 0.67, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.61, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -7.5
   Selection.ShapeRange.IncrementTop -4.75
   Selection.ShapeRange.IncrementRotation 16.34
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleWidth 0.72, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.79, msoFalse,
msoScaleFromTopLeft
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.IncrementLeft -5.45
   Selection.ShapeRange.IncrementTop -7.45
   Selection.ShapeRange.IncrementRotation 18.06
   Call subTimer(100)

   ActiveDocument.Shapes("Group 8").Select
   Selection.ShapeRange.ScaleWidth 0.71, msoFalse,
msoScaleFromBottomRight
   Selection.ShapeRange.ScaleHeight 0.8, msoFalse, msoScaleFromTopLeft
   ActiveDocument.Shapes("Group 8").Select
End Sub

> > Is there any way to control (from code or another macro) where this
> > numbering begins? ie
[quoted text clipped - 17 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 05 Jan 2006 22:49 GMT
> > I don't think so, but what's the difference if you can re-name the shape
> > anything you like at the time it's created?
[quoted text clipped - 10 lines]
> fixed the code below to name the objects explicitly so you can see what
> the animation looks like.

That's a limitation (or feature) of the recorder you'll have to work around.
Relying on a recorded macro ALWAYS giving a newly created shape a particular name
will simply not work.  What if there's already an Oval1 on my slide when I run the
macro?  

But again, since the macro itself can name the shape after creating it, I don't
see that it's a problem, no matter where it runs.  Modify the macro and you're
done.  

Or start with a shape already selected then record your macro to have the
recording apply to the current selection rather than a specific shape.  When
played back, it'll act on the current selection, if any.  

Or error if there isn't one.  

Another reason why distributing raw macro recordings isn't really a wise idea.

> If it was possible to get Word's (or Powerpoint etc) macro recorder to
> explicitly name the objects, you wouldn't need special software or
[quoted text clipped - 520 lines]
> > PPTools:  www.pptools.com
> > ================================================

Signature

--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com

================================================
Ken Johnson - 13 Dec 2005 07:21 GMT
Hi Mad Scientist Jr,
I've sent you an email with some ideas. Let me know if they are at all
useful.
Ken Johnson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.