WD2000: Value out of Range Using WordBasic.InsertFormField.CheckWidth Argument (209929)
The information in this article applies to:
This article was previously published under Q209929 SYMPTOMS
When you use the WordBasic.InsertFormField command with the CheckWidth argument, the following error message may appear: Run-time error '512': Value out of range CAUSE
Because the CheckWidth argument must be specified in twips instead of points, the smallest value that can be used with the CheckWidth argument is 20 twips.
The following macro demonstrates this error:
Sub SetFormFieldCheckBox()
WordBasic.InsertFormField Type:=1, CheckSize:=1, CheckWidth:=18
End Sub
Running the macro example produces the error described in the "Symptoms" section of this article.
If you change the CheckWidth value to 360 (18 points in twips), the macro example will work.
WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To work around this problem, specify the CheckWidth value in twips instead of points.
To convert points to twips, use the following formula:
Twips = 1440/72*Number to convert
For example, to convert 18 points to twips: NOTE: There are 1440 twips per inch and 72 points per inch.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. REFERENCES
For more information about getting help with Visual Basic for Applications,
please see the following article in the Microsoft Knowledge Base:
226118 OFF2000: Programming Resources for Visual Basic for Applications
Modification Type: | Major | Last Reviewed: | 6/17/2005 |
---|
Keywords: | kbbug kbnofix KB209929 |
---|
|