Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2002: VBA Error on Macro Startup If You Open Multiple Excel Instances with RefEdit Control


View products that this article applies to.

This article was previously published under Q321286
For a Microsoft Excel 2000 version of this article, see 320262 (http://support.microsoft.com/kb/320262/EN-US/ ) .

↑ Back to the top


Symptoms

When you open a Microsoft Excel workbook (.xls) or add-in (.xla) that uses the RefEdit control, you may receive one of the following unhandled exception error messages in Microsoft Visual Basic for Applications (VBA) on the first line of code in the project:
Error -2147467259 (&H80004005) : "Unspecified error"
-or-
Automation Error: The process cannot access the file because it is being used by another process
The problem occurs if multiple instances (for example, four or five) of Excel are running. Each instance of Excel contains workbooks or add-ins that also use the RefEdit control, and all of the temporary locations that hold extenders already have open libraries by the same name (one for each instance of Excel that is using the RefEdit control).

↑ Back to the top


Cause

When a Microsoft Visual Basic for Applications (VBA) project that contains the RefEdit control is loaded, VBA creates a control extender for the RefEdit type library. The formation of the control extender is similar to any control that you add to a UserForm. If multiple instances of Excel are running, Fm20.dll may fail while it attempts to create this extender. This failure can result in a VBA runtime error when your code is called.

↑ Back to the top


Resolution

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site: Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language. After the hotfix is installed, the following files will have the listed attributes or later:
   Date         Time   Version      Size       File name
   --------------------------------------------------------
   22-Mar-2002  16:38  2.1.9922.1   1,129,232  Fm20.dll
				

↑ Back to the top


Status

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

↑ Back to the top


More information

Service Pack Information

This problem was first corrected in Office XP Service Pack 3.To resolve this problem, obtain the latest service pack for Microsoft Office XP. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
307841� How to obtain the latest Office XP Service Pack
Because the error occurs before the macro code is run, Excel starts the Visual Basic for Applications (VBA) Integrated Development Environment (IDE) and stops at the function entry point. This is similar to the behavior that occurs if VBA detects a compile error.

Steps to Reproduce the Behavior

  1. Start Excel 2002, and create a new workbook.
  2. Press Alt+F11 to start the Visual Basic for Applications (VBA) Integrated Development Environment (IDE), and then add a new UserForm to the workbook.
  3. Add a RefEdit control to the UserForm.
  4. In ThisWorkbook, type or paste the following code in the Open event:
    Private Sub Workbook_Open()
       Dim x as Object
    End Sub
    					
  5. Save the workbook to a local folder.
  6. Start another instance of Excel.
  7. On the File menu, click Open, and then open another copy of the workbook that you just saved.

    NOTE: You may receive a macro warning dialog box followed by a File in Use dialog box to open the workbook in read-only format. Click Enable Macros and then click Read Only.
  8. Repeat steps 6 and 7 three or four more times until you receive one of the error messages listed in the "Symptoms" section of this article.

For additional information about control extenders in VBA, click the article number below to view the article in the Microsoft Knowledge Base:
290537� OFFXP: EXD Files Are Created When You Insert Controls

↑ Back to the top


Keywords: KB321286, kbofficexppresp2fix, kbfix, kbbug, kbhotfixserver, kbqfe, kbautohotfix

↑ Back to the top

Article Info
Article ID : 321286
Revision : 7
Created on : 2/1/2007
Published on : 2/1/2007
Exists online : False
Views : 261