DOCUMENT:Q195425 09-NOV-1998 [vbwin] TITLE :PRB: Word Fails to Save Custom Document Properties PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0,6.0,97 OPER/SYS:WINDOWS KEYWORDS:kbVBp kbVBp500 kbVBp600 kbAutomation kbPropSheet kbWord97 ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0 - Microsoft Word 97 for Windows --------------------------------------------------------------------- SYMPTOMS ======== Custom document properties that are added to a Word 97 document via Automation are not saved after calling "Save." CAUSE ===== Microsoft Word 97 doesn't "dirty" the document when custom document properties are added via automation. When the document isn't dirty, calls to "Save" just return without performing anything. RESOLUTION ========== In the document to which you're adding properties, set the "Saved" property to False. This will let Microsoft Word know the document needs to be saved. STATUS ====== This behavior is by design. MORE INFORMATION ================ The following Visual Basic code demonstrates how to add a custom document property and set the "Saved" property to False: ' Launch Word Dim wdapp As Object Set wdapp = CreateObject("Word.Application") ' Make it visible... wdapp.Visible = True ' Open a document... Dim doc As Object Set doc = wdapp.Documents.Open("C:\mydocu~1\testdoc.doc") ' Add a custom document property... doc.CustomDocumentProperties.Add "MyProp", False, 1, 123 ' Uncomment this line to let Word know document is "dirty," so it ' will save the new Custom Document Property. 'doc.Saved = False ' Save document doc.Save ' Close Word... wdapp.Quit Additional query words: document properties ====================================================================== Keywords : kbVBp kbVBp500 kbVBp600 kbAutomation kbPropSheet kbWord97 Version : WINDOWS:5.0,6.0,97 Platform : WINDOWS Issue type : kbprb ============================================================================= 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. Copyright Microsoft Corporation 1998.