Macro to Determine If Active Document Is a Template

Last reviewed: July 30, 1997
Article ID: Q107532
The information in this article applies to:
  • Microsoft Word for Windows, version 6.0
  • Microsoft Windows operating system version 3.1

SUMMARY

To determine if the active document is a template, you can dimension the FileSaveAs dialog to determine the file format. If the document is actually a document template, the format field in the FileSaveAs dialog will return a 1.

MORE INFORMATION

FileSaveAs [, .Format = number]

 .Format  0 (zero)  Word document
          1         Document template

The following macro example macro posts a message if the active document is a template.

Sub Main
Dim dlg As FileSaveAs GetCurValues dlg If dlg.Format = 1 Then MsgBox "Active document is a document template"
End Sub

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.

Kbcategory: kbusage kbmacro KBSubcategory:


Additional query words: 6.0 is template FileSaveAS word6
winword format
Version : 6.0
Platform : WINDOWS


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: July 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.