WD97: Errors Setting Border LineWidths Via Macro Commands (165250)



The information in this article applies to:

  • Microsoft Word 97 for Windows

This article was previously published under Q165250

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 detting 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:

176476 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:

173707 OFF97: 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:

163435 VBA: Programming Resources for Visual Basic for Applications


Modification Type:MajorLast Reviewed:11/14/2000
Keywords:kbbug kbdtacode kberrmsg kbmacroexample KB165250