OFF97: Changes to Custom ActiveX Control Are Not Used

ID: Q185473


The information in this article applies to:
  • Microsoft Office 2000 Developer
  • Microsoft Word 2000
  • Microsoft Word 97 for Windows


SYMPTOMS

When you modify a custom ActiveX Control that you are using in an Office program, the changes do not appear in the control in the Office program.


CAUSE

This behavior occurs if the following conditions are true:

  • You create a custom ActiveX Control in a utility or a program, such as Microsoft Visual Basic version 5.0,


  • -and-

  • you use a control in an Office program (for example, Microsoft Word),


  • -and-

  • you change a property or method of a member that belongs to the control in the creator program (for example, you remove or add a method or property),


  • -and-

  • you attempt to use the updated control in the Office program.


  • This problem occurs because the files (.twd and .exd files) that contain the information about the control and are still associated with the original ActiveX Control you inserted; they are not updated or re-created when you modify the control.


WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft Support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://msdn.microsoft.com/support/
To work around this design limitation, delete the associated .exd and .twd files to allow new files to be created. After you do this, the custom ActiveX Control is updated.

Deleting the .exd Files

To delete the files, follow these steps:
  1. Quit all running Microsoft Office programs.


  2. In Microsoft Windows Explorer, open the temporary (Temp) folder. The default location of this folder under Microsoft Windows is the following:

    C:\Windows\Temp


  3. Double-click the Temp folder to view its contents.


  4. The Temp folder should contain one or more subfolders that correspond to Microsoft Office 97 programs.

    For example, the folder that contains the .exd files for Word 97 is Word8.0 and the folder that contains the .exd files for Word 2000 is Word9.0.

    Click to select the Word8.0 / Word9.0 folder.


  5. On the File menu, click Delete.


  6. Repeat these steps as necessary for other Office programs.


Deleting the *.twd Files

You can find the .twd file that is associated with the control in the same folder that contains the control. This file is named so that the root name of the file matches the name of the control, and the file name extension is .twd. For example, MSForms.twd.

The best method for locating these files is to search by using Microsoft Windows Explorer.

To delete the file, follow these steps:
  1. In Microsoft Windows Explorer, point to Find on the Tools menu, and click Files Or Folders.


  2. In the Named box, type the following:

    *.twd.


  3. From the Look In list, click the drive you want to search. For example, to search all of drive C, click (C:).


  4. Click to select the Include Subfolders check box.


  5. Click Find Now.


  6. In the resulting list of found files, click to select the .twd file that is associated with the control.


  7. On the File menu, click Delete.


Updating the Control

In the Office program in which the control is being used, remove and reinsert the control. This step causes the control's type library to be read again, and the control is updated.


STATUS

This behavior is by design in Microsoft Office for Windows.


MORE INFORMATION

When an ActiveX control is inserted, two associated files are created. These files contain the Object Type Library of the control and the extended object members that Visual Basic for Applications or the Office program adds.

For example, when you insert an ActiveX Control in a Word document, the control has certain properties, such as .Top and .Width. The control knows nothing about these properties, but they appear to be part of the control's object model. This is how the extended object works. The extended object provides these container-specific members (for example, .Top and .Width) in addition to the control's members.

These files have file name extensions of .twd and .exd and are created by Visual Basic for Applications or Office programs. If you insert a control in a Word document, and if these .exd and .twd files do not exist, they are created. If they already exist, they are not re-created. This is why the new definition of the method or the property of the custom ActiveX Control is not reflected when you modify it.


REFERENCES

For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

Q163435 VBA: Programming Resources for Visual Basic for Applications

Additional query words: vba

Keywords : kbdta KbVBA kbPowerPt kbWord kbOffice2000 kbExcel97 kbexcel2000 kbpowerpt2000 kbword2000
Version : :; WINDOWS:2000,97
Platform : WINDOWS
Issue type : kbhowto


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