Article ID: 918782 - Last Review: October 15, 2007 - Revision: 1.4

Error message when you create a macro that sets the DashStyle property in Publisher 2007 and in Word 2007: "The specified value is out of range"

On This Page

Expand all | Collapse all

SYMPTOMS

When you create a Microsoft Visual Basic for Applications macro that sets the DashStyle property in Microsoft Office Publisher 2007 and in Microsoft Office Word 2007, you may receive the following error message:
The specified value is out of range

CAUSE

This issue occurs if you try to set the value of the DashStyle property to one of the following enumerated values:
  • msoLineSysDash
  • msoLineSysDot
  • msoLineSysDashDot

RESOLUTION

To resolve this issue, use the following numeric values instead of the enumerated values:
  • 10 = msoLineSysDash
  • 11 = msoLineSysDot
  • 12 = msoLineSysDashDot

MORE INFORMATION

Steps to reproduce the issue

  1. Start Publisher 2007 or Word 2007.
  2. Create a new blank document.
  3. Draw a rectangle.
  4. On the Tools menu, click Macros, and then click Visual Basic Editor.
  5. Create a new macro that contains the following code:
    sub runThis()
    
    ThisDocument.Pages(1).Shapes(1).Line.DashStyle = msoLineSysDashDot
    
    end sub
  6. On the File menu, click Save Publication1.
  7. Close Visual Basic Editor.
  8. On the Tools menu, click Macros, and then click Macros.
  9. Click ThisDocument.runThis, and then click Run.

APPLIES TO
  • Microsoft Office Publisher 2007
  • Microsoft Office Word 2007
Keywords: 
kberrmsg kbtshoot kbprb kbexpertisebeginner KB918782
 

Article Translations

 

Related Support Centers