WDK: Invoice3 Template Causes WordBasic Error 134

ID: Q145323

The information in this article applies to:

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.

1. On the File menu, click Open.

2. Locate Invoice3.dot and click OK.

3. On the Tools menu, click Macro.

4. Select the AutoNew macro, and then click Edit.

5. On the Edit menu, click Find.

6. In the Find What box, type "month" (without the quotation marks). Click

   Find Next.

   Word scrolls to the code that results in the error message.

7. Click the Cancel button.

8. Modify the macro code as follows:

   The current code:

   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:

     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

10. On the File menu, click Save.

   This saves changes to the macro.

11. On the File menu, click Close.

  This closes the macro window.

12. On the File menu, click Save.

  This saves the changes to the Invoice3.dot template.

13. On the File menu, click Close.

  This closes the Invoice3 template.

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.

REFERENCES

"Microsoft Word Developers Kit," third edition, Appendix B, pages 969-1001

KBCategory: KBSubcategory:

Additional query words:

Version           : 6.0 7.0
Platform          : WINDOWS

Last Reviewed: January 20, 1999