Microsoft KB Archive/185473

= PRB: Changes to Custom ActiveX Control Are Not Used =

Article ID: 185473

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Office XP Developer Edition
 * Microsoft Office 2000 Developer Edition
 * Microsoft Word 2002 Standard Edition
 * Microsoft Word 2000 Standard Edition
 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q185473



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, -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.



RESOLUTION
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
 * 1) Double-click the Temp folder to view its contents.
 * 2) The Temp folder should contain one or more subfolders that correspond to Microsoft Office programs.

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

Click to select the Word8.0.
 * 1) On the File menu, click Delete.
 * 2) 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.
 * 1) From the Look In list, click the drive you want to search. For example, to search all of drive C, click (C:).
 * 2) Click to select the Include Subfolders check box.
 * 3) Click Find Now.
 * 4) In the resulting list of found files, click to select the .twd file that is associated with the control.
 * 5) 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.

