WD98: Errors Setting Border LineWidths Via Macro Commands

Last reviewed: March 13, 1998
Article ID: Q182255
The information in this article applies to:
  • Microsoft Word 98 Macintosh Edition

SYMPTOMS

When you attempt to set the Line Width for a border using Microsoft Visual Basic for Applications commands, you receive one of the following errors:

   Run-time error '5843': One of the values passed to this method or
   property is out of range.

   -or-

   Run-time error '4120': Bad Parameter

CAUSE

You are attempting to set a line width which is not available for the current or specified line style.

WORKAROUND

When applying borders using Visual Basic For Applications commands, you can specify the line style and the line width of the border to be applied. Each border line style has a different number of varying line widths that can be applied to a border. That is, all line widths are not available to use with every line style.

Also, the list of wdLineWidth constants are available for use in a macro regardless of the line style being applied. There is no programmatic method available for determining whether a particular line width is a valid width to use with a chosen border line style. If you apply an invalid line width to a line style and then compile and run your macro, an error occurs.

For more information about setting line widths, click the Office Assistant while in the Visual Basic Editor, type "LineWidth," click Search, and then click to view "LineWidth Property."

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If the Assistant is not able to answer your query, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q176476
   TITLE     : OFF: Office Assistant Not Answering Visual Basic Questions


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

For additional information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q181058
   TITLE     : OFF98: How to Run Sample Code from Knowledge Base Articles

REFERENCES

For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q163435
   TITLE     : VBA: Programming Resources for Visual Basic for
               Applications


Additional query words: vb vba vbe
Keywords : kbdta kbdtacode kbmacroexample macword98
Version : MACINTOSH:98
Platform : MACINTOSH
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.