Macro to Determine Attached Template Filename

Last reviewed: August 4, 1997
Article ID: Q113435
6.00 6.00a WINDOWS kbusage kbmacro

The information in this article applies to:

  • Microsoft Word for Windows, version 6.0, 6.0a

SUMMARY

In Word 6.0 for Windows, your macro may need to determine which template is attached to the current document. To determine which template is attached, you can dimension the FileTemplates or FileSummaryInfo dialog box to retrieve the template name.

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 either of the following macros to return the filename and the MS-DOS path of the attached template file:

Sub MAIN
Dim dlg As FileTemplates GetCurValues dlg x$ = dlg.Template MsgBox x$
End Sub

 -or-

Sub MAIN
Dim dlg As FileSummaryInfo GetCurValues dlg x$ = dlg.Template Msgbox x$
End Sub

MORE INFORMATION

The following example determines if the current template is the Normal template file (NORMAL.DOT). If the Normal template is not attached, the macro uses the FileTemplates statement to attach the Normal template file.

Sub MAIN
Dim dlg As FileSummaryInfo GetCurValues dlg x$ = dlg.Template If InStr(x$, "NORMAL.DOT") = 0 Then
 FileTemplates .Template = "Normal.dot"
End If
End Sub

REFERENCES

"Microsoft Word Developer's Kit," pages 89-90

Kbcategory: kbusage kbmacro KBSubcategory:


Additional reference words: 6.00 6.00a Dim FileTemplates word6
winword FileSummaryInfo
Version : 6.00 6.00a
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: August 4, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.