Microsoft KB Archive/918782

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

Article ID: 918782

Article Last Modified on 10/15/2007

-

APPLIES TO


 * Microsoft Office Publisher 2007
 * Microsoft Office Word 2007

-



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



Steps to reproduce the issue
 Start Publisher 2007 or Word 2007. Create a new blank document. Draw a rectangle. On the Tools menu, click Macros, and then click Visual Basic Editor.  Create a new macro that contains the following code: sub runThis

ThisDocument.Pages(1).Shapes(1).Line.DashStyle = msoLineSysDashDot

end sub  On the File menu, click Save Publication1.</li> Close Visual Basic Editor.</li> On the Tools menu, click Macros, and then click Macros.</li> Click ThisDocument.runThis, and then click Run.</li></ol>

<div class="references_section">

Keywords: kberrmsg kbtshoot kbprb kbexpertisebeginner KB918782

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.