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

Q126366


The information in this article applies to:


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 : kberrmsg kbmacro wordnt winword ntword macword word6 word7 word95
Issue type : kbbug
Technology : kbHWMAC kbOSMAC kbWordSearch kbWordMacSearch kbWord700Search kbZNotKeyword2 kbZNotKeyword3 kbWord600Mac kbWord601aMac kbWord601Mac kbWord600 kbWord600a kbWord600c kbWord700 kbWord600NT kbWord700a


Last Reviewed: November 5, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.