"File in Use by Another Program" After OLE Automation Session

ID: Q105410


The information in this article applies to:
  • Microsoft Word for Windows, version 6.0
  • Microsoft Windows 3.1


SYMPTOMS

If you run an OLE 2.0 automation session in which you create a WordBasic object in a client application (such as Microsoft Visual Basic version 3.0) that accesses Word for Windows as a server, the following error message may occur in the next session of Word when you try to save your NORMAL.DOT file:

This file is in use by another application or user.
(<path>\NORMAL.DOT)


CAUSE

The Word command line in your Windows REG.DAT file does not include the /Automation switch. Specifically, in the CLSID key, under the WordBasic (WordBasic) Class ID key, the LocalServer key value must include the /Automation switch. If this switch is missing, the OLE 2.0 Automation (OLE Auto) transaction launches a session of Word that is not completely removed from memory when you close Word. In other words, it remains in memory as a "ghost" Word session. As a result, the file handle to the NORMAL.DOT file remains open, and this prevents you from saving NORMAL.DOT in a later Word session.

The "ghost" Word session does not appear in the Windows Task List. The only way to close it is to exit and restart Windows.

WORKAROUND

Save your NORMAL.DOT file to a different name such as NORMAL.OLD, then exit Word. Exit and restart Windows. If necessary, you can rename NORMAL.OLD to NORMAL.DOT. Then resolve this problem using the steps in the Resolution section below.

RESOLUTION

Use one of the following methods to add the /Automation switch to your REG.DAT file.

Method 1: Merge WINWORD6.REG Registration File

Note: The WINWORD6.REG file contains information based on the options you chose when you originally set up Word. If the location of WINWORD.EXE or any of the OLE applications supplied with Word has changed since you first installed Word, the WINWORD6.REG file will not correctly update your registration information. In this case, you should use Method 2 below instead.

  1. In Windows File Manager, open your Word 6.0 program directory (the default is WINWORD6).


  2. In the Word 6.0 program directory, select the WINWORD6.REG file.


  3. From the File menu, choose Run and then choose OK.
    -or-
    Double-click the WINWORD6.REG file.


  4. The following message should appear in a Registration Info Editor dialog box:


  5. Information in <drive and path>\WINWORD6.REG has been successfully registered in the registration database.

Method 2: Manually Edit the REG.DAT File

Use the following instructions to add the /Automation switch to your REG.DAT file:

  1. In Windows Program Manager, choose Run from the File menu.


  2. Type REGEDIT /v and then choose OK.


  3. From the Search menu, choose Find Key.


  4. In the Find What box, type \CLSID and then choose OK.


  5. Under the CLSID key, locate the WordBasic Class ID key, which appears as follows:
    
          \ 
          |-CLSID
           |-{000209FE-0000-0000-C000-000000000046}=WordBasic
            |-AutoConvertTo <optional key>
            |-LocalServer=<path>WINWORD.EXE
            |-ProgID=WordBasic 
    Note: There may be several other Class ID keys above the WordBasic Class ID key, so you may need to scroll through several screens to find it.


  6. Select the LocalServer key.


  7. In the Value box, modify the setting so it appears as follows:


  8. <path>WINWORD.EXE /Automation
  9. After you add the /Automation switch to the LocalServer value, the WordBasic Class ID key should appear as follows:


  10. 
          \ 
          |-CLSID
           |-{000209FE-0000-0000-C000-000000000046}=WordBasic
            |-AutoConvertTo <optional key>
            |-LocalServer=<path>WINWORD.EXE /Automation
            |-ProgID=Word.Basic 

MORE INFORMATION

By default, the Word Setup program adds the /Automation command line switch to REG.DAT. If you manually delete this switch, Word does not restore it the next time you start Word.

Additional query words: 6.0 object linking embedding wordbasic winword word6

Keywords : kbole
Version : WINDOWS:3.1,6.0
Platform : WINDOWS
Issue type :


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