WD: FileClose in Macro Doesn't Work with Protected Form

Last reviewed: February 5, 1998
Article ID: Q126366
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows NT, version 6.0
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

SYMPTOMS

If a WordBasic macro contains FileClose and the macro is used on exit from a form field of a protected document, the FileClose command will not function, and the following error message will appear:

   WordBasic Err=102, Command Failed

WORKAROUND

WARNING: ANY USE BY YOU OF THE 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.

Use the following macro instead of the FileClose command in a macro to close a protected form:

   Sub MAIN
      a = Now()
      OnTime a, "FileClose"
   End Sub

When using the above workaround, you will be unable to use the SAVE parameter for the FileClose command. If you need to use this parameter, use the SetDocumentDirty command instead. The following macro uses the SetDocumentDirty command to close the document without saving.

   Sub MAIN
      a = Now()
      SetDocumentDirty 0
      OnTime a, "FileClose"
   End Sub

STATUS

Microsoft has confirmed this to be a problem in Word versions 6.0, 6.0a, 6.0c, and 7.x. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: forms
Keywords : macword ntword winword word6 word7 word95 wordnt kberrmsg kbmacro
Version : 6.0 6.0a 6.0c 7.0 7.0a | 6
Platform : MACINTOSH WINDOWS
Issue type : kbbug
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.