WD98: Errors Setting Border LineWidths Via Macro Commands

ID: Q182255

The information in this article applies to:

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: wordcon vb vba vbe
Keywords          : kbdta kbdtacode OffVBA kbmacroexample macword98 
Version           : MACINTOSH:98
Platform          : MACINTOSH
Issue type        : kbprb

Last Reviewed: April 7, 1999