Word

Animated Word Art

Ease of Use

Intermediate

Version tested with

2000 

Submitted by:

Brandtrock

Description:

WordArt in a Word document can be animated to a certain extent. This example illustrates how to twist the letters back and forth and how to spin the WordArt like an airplane propellor. 

Discussion:

The animation of a WordArt object in a document can make quite an impression on co-workers or clients. No real functionality is added, this is purely bells and whistles stuff. The speed of the animations may vary depending upon your computer. The cycle and angle variations should be adjusted as required to suit your own particular system. 

Code:

instructions for use

			

'****************** '* Code for Module1 '****************** Option Explicit Dim m As Variant Dim i As Variant 'Thanks to John Walkenbach for illustrating how to do this 'in Excel. Adapted to Word by Brandtrock. Sub StartDemo() On Error Resume Next 'twist Word Art1 'WordArt2 text twists slower because it uses an increment of 0.0675 ActiveDocument.Shapes("WordArt 1").Select m = 1 For i = 1 To 80 Selection.ShapeRange.TextEffect.Tracking = m m = m + 0.125 'this increments the twist, a smaller number will slow it down. DoEvents Next i For i = 80 To 1 Step -1 Selection.ShapeRange.TextEffect.Tracking = m m = m - 0.125 'this increments the twist, a smaller number will slow it down. DoEvents Next i Selection.ShapeRange.TextEffect.Tracking = 1 'Spin WordArt2 text 'this cycles faster than the next spin ActiveDocument.Shapes("WordArt 2").Select For i = 1 To 8 'controls spin Selection.ShapeRange.IncrementRotation 45# 'the degree of rotation 'multiplied by the upper bound of the loop should equal 360 in order 'for the WordArt to stop in the right place. A longer loop with a smaller 'angle will slow the animation down. DoEvents Next i Selection.ShapeRange.TextEffect.Tracking = 1 'twist WordArt2 text 'WordArt1 text twists faster because it uses an increment of 0.125 ActiveDocument.Shapes("WordArt 2").Select m = 1 For i = 1 To 80 Selection.ShapeRange.TextEffect.Tracking = m m = m + 0.0675 'this increments the twist, a bigger number will speed it up. DoEvents Next i For i = 80 To 1 Step -1 Selection.ShapeRange.TextEffect.Tracking = m m = m - 0.0675 'this increments the twist, a bigger number will speed it up. DoEvents Next i Selection.ShapeRange.TextEffect.Tracking = 1 'spin WordArt2 text 'this cycles slower than the first spin ActiveDocument.Shapes("WordArt 2").Select For i = 1 To 72 Selection.ShapeRange.IncrementRotation 15# 'the degree of rotation 'multiplied by the upper bound of the loop should equal 360 in order 'for the WordArt to stop in the right place. A longer loop with a smaller 'angle will slow the animation down. DoEvents Next i Selection.ShapeRange.TextEffect.Tracking = 1 Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=1, Name:="" End Sub '******************** '* Code for ThisDocument '******************** Option Explicit Private Sub Document_Open() StartDemo End Sub

How to use:

  1. Open a document.
  2. Create two WordArts of your own design.
  3. Copy the code marked Code for Module1.
  4. Press Alt + F11 to open the Visual Basic Editor (VBE).
  5. From the Menu, choose Insert-Module.
  6. Paste the code into the right-hand code window.
  7. Double-click on the ThisDocument module.
  8. Select Document from the top left drop down box.
  9. Select Open from the right drop down box.
  10. Type StartDemo between the Private Sub Document_Open() line and the End Sub line.
  11. Close the VBE
  12. Save the file.
  13. Close the file.
 

Test the code:

  1. To test your code, simply open the document you just saved (or the example file). The Document Open event will fire the StartDemo macro upon opening.
 

Sample File:

Moving_Word_Art_doc.zip 11.86KB 

Approved by mdmackillop


This entry has been viewed 134 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express