Microsoft KB Archive/145323

{|
 * width="100%"|

WDK: Invoice3 Template Causes WordBasic Error 134

 * }

Q145323

-

The information in this article applies to:


 * Microsoft Word for Windows NT, version 6.0
 * Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows, version 7.0

-

SYMPTOMS
When you create a new document with the Invoice3.dot template from the Word Developers Kit (third edition), the following error message appears:

WordBasic ERR=134

An argument to a function contained an illegal date or time.

CAUSE
This problem occurs if you use a system date of December.

WORKAROUND
To work around this problem, use the following steps:

WARNING: ANY USE BY YOU OF THE OR MACRO CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

 On the File menu, click Open. Locate Invoice3.dot and click OK. On the Tools menu, click Macro. Select the AutoNew macro, and then click Edit. On the Edit menu, click Find. In the Find What box, type month. Click Find Next.

Word scrolls to the code that results in the error message. Click the Cancel button.  Modify the macro code as follows:

The current code: <pre class="CODESAMP">  If Month(Today) <> 12 Then SetFormResult "ShipDate", Date$(DateSerial(Year(Today), Month(Today) + 1, Day(Today))) Else SetFormResult "ShipDate", Date$(DateSerial(Year(Today) + 1, Month(Today) + 1, Day(Today))) End If Change the code to read as follows: <pre class="CODESAMP">    If Month(Today) <> 12 Then SetFormResult "ShipDate", Date$(DateSerial(Year(Today), Month(Today) + 1, Day(Today))) Else SetFormResult "ShipDate", Date$(DateSerial(Year(Today) + 1, 1, Day(Today))) End If </li> On the File menu, click Save.

This saves changes to the macro.</li> On the File menu, click Close.

This closes the macro window.</li> On the File menu, click Save.

This saves the changes to the Invoice3.dot template.</li> On the File menu, click Close.

This closes the Invoice3 template.</li></ol>

STATUS
Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.