Word

Create a Timer in Word

Ease of Use

Intermediate

Version tested with

2000 

Submitted by:

Anne Troy

Description:

Ticks off one second at a time by rotating your drawn shape using the OnTime method traditionally used in Excel. 

Discussion:

More for fun and demonstration purposes, this could be used in a document that is viewed online as opposed to being printed. 

Code:

instructions for use

			

Option Explicit Sub Document_Open() Application.OnTime When:=Now + TimeValue("00:00:01"), Name:="ShapeMover" End Sub Sub ShapeMover() Dim oSH As Shape Beep Set oSH = ActiveDocument.Shapes(1) oSH.IncrementRotation 10 Application.OnTime When:=Now + TimeValue("00:00:01"), Name:="ShapeMover" End Sub

How to use:

  1. Copy the code above.
  2. Open a blank Word document.
  3. Hit Alt+F11 to open the Visual Basic Editor (VBA).
  4. At left, double-click ThisDocument.
  5. Paste the code into the code window at right.
  6. Close the VBE.
  7. Using the drawing toolbar, choose an autoshape (like an arrow) and place it on the document.
  8. Save the file and close it; this macro is designed to run when the document is opened.
 

Test the code:

  1. Open the file.
 

Sample File:

ontime.zip 6.67KB 

Approved by mdmackillop


This entry has been viewed 196 times.

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