Create Spirographs in PowerPoint Programmatically

Created: Friday, March 20, 2009, posted by at 11:08 am


Have you created a Spirograph as a child, or even later? If you don’t know what a Spirograph looks like, the picture below may refresh your memory.

Create Spirographs in PowerPoint Programmatically

Yes, Spirograph is one of those brands like Xerox that have lesser-known, technical names. Spirographs are essentially Hypotrochoids or Epitrochoids. Even with such technical words, Spirographs can be fun, especially when you don’t have to draw with ball point pens on paper, and can do it instead on a PowerPoint slide!

You can create Spirograph in PowerPoint quite easily, but it takes time and effort. My friend Shyam Pillai, who is a PowerPoint programming guru stepped in and said I could create Spirographs so much faster programmatically using this code:

Can You Use Scripts in PowerPoint?

If you don’t know how to use macro snippets or scripts inside PowerPoint, look here to get started easily.

Sub CreateSpirograph()
Dim oShp As Shape
Dim I As Single
Const ROTATION_INCREMENT = 5  'Rotation Increment
Const ROTATION_MAX = 360 'Max rotation
'Select a shape on the slide and then run this
Set oShp = ActiveWindow.Selection.ShapeRange(1)
 
For I = ROTATION_INCREMENT To ROTATION_MAX Step ROTATION_INCREMENT
    With oShp.Duplicate
        .Rotation = I
        .Left = oShp.Left
        .Top = oShp.Top
    End With
Next
End Sub

Remember you need to have some shape selected before you run this code.

You can change the ROTATION_INCREMENT and ROTATION_MAX values to get different graphs for your Spirographs in PowerPoint.


Shyam Pillai
Shyam Pillai was a Microsoft PowerPoint MVP. His site has many VBA snippets, plus free and commercial PowerPoint add-ins. Among his well-known add-ins for PowerPoint are Image Importer Wizard, SecurePack, Sequential Save, and Shyam’s Toolbox.

Want to create Spirographs without the programming code? Look at our Spirographs in PowerPoint tutorial.

The views and opinions expressed in this blog post or content are those of the authors or the interviewees and do not necessarily reflect the official policy or position of any other agency, organization, employer, or company.



Related Posts

  • VBA Code: Paste in Place
    Ever tried copying an object in PowerPoint and found it refuses to sit still when pasted? Instead of landing neatly atop the original—like a twin retu...
  • VBA Code: Change Linked Videos to Embedded?
    Have you created or inherited a PowerPoint file that contains a linked video file that you want to share with others? Wouldn't it be easier if you cou...
  • VBA Code: Remove Underlines from Descenders
    First a little history. This started with our Stop Underlining Your Descenders! article. Of course, as per that article you can manually remove under...
  • VBA Code: Change Embedded Videos to Linked?
    No Longer Working?This code no longer works in PowerPoint and is retained for archival reasons.Have you created a huge monster PowerPoint file that's ...

Filed Under: Programming
Tagged as: , , , , , ,

Comments Off on Create Spirographs in PowerPoint Programmatically

Comments are closed.

Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.

Plagiarism will be detected by Copyscape

© 2000-2026, Geetesh Bajaj - All rights reserved.

since November 02, 2000



-->