Microsoft Excel ActiveX Controls Disabled?

后端 未结 11 2270
死守一世寂寞
死守一世寂寞 2020-11-22 06:43

I have some Excel worksheets that use ActiveX checkboxes to control certain activity. They worked recently but today started to give errors. I was alerted to this by a col

相关标签:
11条回答
  • 2020-11-22 07:22

    I want to provide an answer that worked as the only thing for me (I realize that I might be the only one ever). I had in one macro that I was calling using the ribbon. It had the following code:

    colStore = new Collection
    

    I wasn't aware that it throws an error so I was baffled and tried everything in here. The button just stopped working and I couldn't get it to work. When I noticed the error and corrected it to:

    Set colStore = new Collection
    

    It started working again. Absolutely strange if you ask me but maybe it helps someone out there who was as desperate as me.

    0 讨论(0)
  • Advice in KB and above didn't work for me. I discovered that if one Excel 2007 user (with or without the security update; not sure of exact circumstances that cause this) saves the file, the original error returns.

    I discovered that the fastest way to repair the file again is to delete all the VBA code. Save. Then replace the VBA code (copy/paste). Save. Before attempting this, I delete the .EXD files first, because otherwise I get an error on open.

    In my case, I cannot upgrade/update all users of my Excel file in various locations. Since the problem comes back after some users save the Excel file, I am going to have to replace the ActiveX control with something else.

    0 讨论(0)
  • 2020-11-22 07:29

    The best source of information and updates on this issue I could find is in the TechNet Blogs » The Microsoft Excel Support Team Blog (as mentioned):

    Form Controls stop working after December 2014 Updates (Updated March 10, 2015)

    On March 2015 a hotfix was released in addition to the automated fix-it and manual instructions, and it's available on Windows Update as well.

    The latest update and fix from Microsoft: 3025036 "Cannot insert object" error in an ActiveX custom Office solution after you install the MS14-082 security update

    STATUS: Update March 10, 2015:

    Hotfixes for this issue have been released in the March 2015 Updates for Office 2007, 2010 & 2013.

    General info about the problem:

    For some users, Form Controls (FM20.dll) are no longer working as expected after installing MS14-082 Microsoft Office Security Updates for December 2014. Issues are experienced at times such as when they open files with existing VBA projects using forms controls, try to insert a forms control in to a new worksheet or run third party software that may use these components.

    https://technet.microsoft.com/en-us/library/security/ms14-082.aspx

    You may receive errors such as: "Cannot insert object"; "Object library invalid or contains references to object definitions that could not be found"; "The program used to create this object is Forms. That program is either not installed on your computer or it is not responding. To edit this object, install Forms or ensure that any dialog boxes in Forms are closed." [...] Additionally, you may be unable to use or change properties of an ActiveX control on a worksheet or receive an error when trying to refer to an ActiveX control as a member of a worksheet via code.

    Manual and additional solutions:

    Scripting solution:

    Because this problem may affect more than one machine, it is also possible to create a scripting solution to delete the EXD files and run the script as part of the logon process using a policy. The script you would need should contain the following lines and would need to be run for each USER as the .exd files are USER specific.

    del %temp%\vbe\*.exd
    del %temp%\excel8.0\*.exd
    del %appdata%\microsoft\forms\*.exd
    del %appdata%\microsoft\local\*.exd
    del %temp%\word8.0\*.exd
    del %temp%\PPT11.0\*.exd
    

    Additional step:

    If the steps above do not resolve your issue, another step that can be tested (see warning below):

    1. On a fully updated machine and after removing the .exd files, open the file in Excel with edit permissions.

    2. Open Visual Basic for Applications > modify the project by adding a comment or edit of some kind to any code module > Debug > Compile VBAProject.

    3. Save and reopen the file. Test for resolution.

    If resolved, provide this updated project to additional users.

    Warning: If this step resolves your issue, be aware that after deploying this updated project to the other users, these users will also need to have the updates applied on their systems and .exd files removed as well.

    0 讨论(0)
  • 2020-11-22 07:30

    I'm an Excel developer, and I definitely felt the pain when this happened. Fortunately, I was able to find a workaround by renaming the MSForms.exd files in VBA even when Excel is running, which also can fix the issue. Excel developers who need to distribute their spreadsheets can add the following VBA code to their spreadsheets to make them immune to the MS update.

    Place this code in any module.

    Public Sub RenameMSFormsFiles() 
      Const tempFileName As String = "MSForms - Copy.exd"  
      Const msFormsFileName As String = "MSForms.exd"  
      On Error Resume Next 
    
      'Try to rename the C:\Users\[user.name]\AppData\Local\Temp\Excel8.0\MSForms.exd file  
      RenameFile Environ("TEMP") & "\Excel8.0\" & msFormsFileName, Environ("TEMP") & "\Excel8.0\" & tempFileName 
      'Try to rename the C:\Users\[user.name]\AppData\Local\Temp\VBE\MSForms.exd file  
      RenameFile Environ("TEMP") & "\VBE\" & msFormsFileName, Environ("TEMP") & "\VBE\" & tempFileName 
    End Sub  
    
    Private Sub RenameFile(fromFilePath As String, toFilePath As String) 
      If CheckFileExist(fromFilePath) Then 
          DeleteFile toFilePath  
          Name fromFilePath As toFilePath  
      End If  
    End Sub
    
    Private Function CheckFileExist(path As String) As Boolean 
      CheckFileExist = (Dir(path) <> "")  
    End Function  
    
    Private Sub DeleteFile(path As String) 
      If CheckFileExist(path) Then 
          SetAttr path, vbNormal  
          Kill path  
      End If  
    End Sub    
    

    The RenameMSFormsFiles subroutine tries to rename the MSForms.exd files in the C:\Users\[user.name]\AppData\Local\Temp\Excel8.0\ and C:\Users\[user.name]\AppData\Local\Temp\VBE\ folders to MSForms - Copy.exd.

    Then call the RenameMSFormsFiles subroutine at the very beginning of the Workbook_Open event.

    Private Sub Workbook_Open() 
      RenameMSFormsFiles  
    End Sub
    

    The spreadsheet will try to rename the MSForms.exd files when it opens. Obviously, this is not a perfect fix:

    1. The affected user will still experience the ActiveX control errors when running the VBA code the very first time opening the spreadsheet. Only after executing the VBA code once and restarting Excel, the issue is fixed. Normally when a user encounters a broken spreadsheet, the knee-jerk reaction is to close Excel and try to open the spreadsheet again. :)
    2. The MSForms.exd files are renamed every time the spreadsheet opens, even when there's no issue with the MSForms.exd files. But the spreadsheet will work just fine.

    At least for now, Excel developers can continue to distribute their work with this workaround until Microsoft releases a fix.

    I've posted this solution here.

    0 讨论(0)
  • 2020-11-22 07:30

    Simplified instructions for end-users. Feel free to copy/paste the following.

    Here’s how to fix the problem when it comes up:

    1. Close all your Office programs and files.
    2. Open Windows Explorer and type %TEMP% into the address bar, then press Enter. This will take you into the system temporary folder.
    3. Locate and delete the following folders: Excel8.0, VBE, Word8.0
    4. Now try to use your file again, it shouldn't have any problems.

    You might need to wait until the problem occurs in order for this fix to work. Applying it prematurely (before the Windows Update gets installed on your system) won't help.

    0 讨论(0)
提交回复
热议问题