ActiveX控件命令按钮的代码名称发生错误更改 [英] Spurious change in code name of ActiveX control command button

查看:202
本文介绍了ActiveX控件命令按钮的代码名称发生错误更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不重复,因为在所述),并将其转换为例如表格控制按钮,但目的是避免这种核选择。

解决方案

同事发现,如果在机器上安装了Office 2010和Office 2013产品,则可能会发生这种情况。要解决这个问题的步骤是:


  1. 下载这些修补程序:




  2. 关闭所有Office程序(包括Lync)。


  3. 安装Office 2010补丁。

  4. 安装Office 2013补丁。

  5. 从您的个人资料和所有其他用户个人资料中删除* .exd文件。有关说明,请参阅此堆栈溢出回答此Microsoft解决方案

  6. 重新启动机器。


Not a duplicate because the issue described here happens despite having deleted the *.exd files as suggested in the answer to Excel renaming Activex Controls on other computers and elsewhere.


One particular machine on our network (let's call it "Computer 2") spuriously and silently changes the code name of ActiveX command buttons placed in Excel workbooks. Whatever the (Name) property of a button was before, it returns it to the default CommandButton* scheme. (CommandButton1, CommandButton2... etc.)

Witness the screenshots below. The code name of btn2 changes to CommandButton1 when opened on Computer 2.

Why? How do I fix this?

I can even have the exact same workbook opened from the same Book1.xlsm file on a network drive simultaneously on both machines (one of them read-only, obviously). Looking at both screens at the same time, the button names are different! Computer 2 changed it.

This, of course, breaks the functionality of the buttons, because they no longer trigger their intended event code. In the example below, btn2 used to call Private Sub btn2_Click() from the sheet module and execute the code in that Sub. But on Computer 2, the button is no longer named btn2, so it doesn't trigger that event; it does nothing — or worse, if there happened to be a button called CommandButton1 before, it triggers that unrelated event.

Workbook opened on Computer 1:

Exact same workbook, but this time on Computer 2:

Now, this has happened to me before. Once or twice over the years, on a couple different machines, all my commandbuttons got renamed like that. But I've never been able to reproduce this, and I thought, corrupted workbook, no big deal.

But this happens consistently on Computer 2, every single time.

Non-ActiveX, Form Control buttons, such as "Form Button 1" in the example above, are unaffected by this issue. An obvious but tedious fix would be to get rid of all my ActiveX buttons (as suggested in this answer) and convert them into e.g. Form Control buttons, but the aim is to avoid this nuclear option.

解决方案

A colleague found out that this can occur if there is a mixture of Office 2010 and Office 2013 products installed on a machine. The procedure to fix this is:

  1. Download these patches:

  2. Close all Office programs (including Lync if you have it).

  3. Install the Office 2010 patch.
  4. Install the Office 2013 patch.
  5. Remove *.exd files from your profile and for all other user profiles. For instructions, see this Stack Overflow answer and this Microsoft solution.
  6. Restart your machine.

这篇关于ActiveX控件命令按钮的代码名称发生错误更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆