Microsoft KB Archive/212560

From BetaArchive Wiki
Knowledge Base


WD2000: Run-time Error 438 When You Try to Get Document Properties from Template

Article ID: 212560

Article Last Modified on 10/11/2006



APPLIES TO

  • Microsoft Word 2000 Standard Edition



This article was previously published under Q212560


SYMPTOMS

When you use the Visual Basic for Applications MacroContainer object to try to obtain document properties from a template, you may receive the following error message:

Run-time error '438':

Object doesn't support this property or method.

CAUSE

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles


This problem occurs if the template in which this macro is stored is included as a global add-in.

For example:

The following sample Visual Basic for Applications macro runs successfully if you first open the template in Word. However, this same macro produces the run-time error message if the template in which it is located is included as a global add-in:

Sub GetKeywords()
   MsgBox MacroContainer.BuiltInDocumentProperties(wdPropertyKeywords)
End Sub
                

WORKAROUND

To work around this problem, remove the template that contains the macro from the global templates and add-ins:

  1. On the Tools menu, click Templates and Add-ins.
  2. In the Templates and Add-ins dialog box, in the Global Templates and Add-ins box, click to select the template that contains your macro, and then click Remove.
  3. Click OK to close the Templates and Add-ins dialog box.

Then open the template or document that contains your macro before you run the macro in your new template or document.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

REFERENCES

For additional information about getting help with Visual Basic for Applications, click the article numbers below to view the articles in the Microsoft Knowledge Base:

212623 WD2000: Macro Programming Resources


226118 OFF2000: Programming Resources for Visual Basic for Applications



Additional query words: vb vba vbe

Keywords: kbbug kbdtacode kberrmsg kbpending KB212560