电脑|电脑配置|电脑故障|电脑技巧|电脑软件

2003 excel右键不能用的解决

2003excel右键不能用(别的地反都能用,就是只有光标点到ABC和123选择整行整列的时候不能右击)为什么啊?希望大家帮我解决问题     ALT+F11,看看里面有几个VBAProject对象,如果两个,说明有自动宏,查找EXCEL11删除,如果1个,看看有没有代码,如果有,删除即可。 工具---加载宏里面看看,有没有用户写的加载宏,如果有,取消即可。 最后一个就是4.0宏表了,也能自动运行代码。 以上所说再加上模板文件就是所有能影响表格的因素了,要挨个检查吧。   ALT+F11,插入模块,复制下面的代码,运行一下,看看有没有隐藏的4.0宏表。 如果有,删除宏表。 sub m () ThisWorkbook.Excel4MacroSheets(1).Visible = True end sub     如果:运行错误9 ,下标越界 那就是没有宏表了 这时:这段代码是启用右键的,试试 sub m () Dim myBar As CommandBar For Each myBar In CommandBars If myBar.Type = msoBarTypePopup Then myBar.Enabled = True End If Next End Sub 其他方法汇总:

Excel工作表中鼠标右键不能使用解决方法

第一种方法:

运行如下VBA程序,这种方法比较安全,如仍不能恢复则顺序采用以下两种方法:

Private Sub 恢复右键1()

       Application.CommandBars("cell").Reset  '右键点单元格恢复

End Sub

以上语句也参考:

Application.CommandBars("ply").Enabled = true '右键点工作表标签是否可用 Application.CommandBars("cell").Enabled = true '右键点单元格是否可用 Application.CommandBars("toolbar list").Enabled = true '右键点工具栏及“视图”-“工具栏”是否可用 Application.CommandBars("autocalculate").Enabled = true '右键点状态栏是否可用

 

如果是在“分页预览”的工作表中改变右键菜单造成默认菜单不能恢复的,则引用右键菜单代码,但不同操作系统和Office版本其代码可能不一样,通常30~45之间:

Private Sub 恢复右键2()

        Application.CommandBars(41).Reset  'Win7 Excel2007        'Application.CommandBars(39).Reset  'WinXP Excel2007

End Sub

 可以通过以下程序查看右键(Cell)代码:

Sub ShowMenuName() '在当前单元格以下显示Excel菜单和工具栏Id与对应名称 Dim I As Integer Cells(1, 1) = "CommandBars(Id)" Cells(1, 2) = "CommandBars(Id).Name" For I = 1 To 95     Cells(I + 1, 1) = I     Cells(I + 1, 2) = Application.CommandBars(I).Name Next I End Sub

第二种方法:

运行如下VBA(推荐使用)程序,遍历CommandBars对象集合:  Private Sub 恢复右键3()

 Dim ZHYZ As CommandBar          For Each ZHYZ In Application.CommandBars                ZHYZ.Enabled = True          Next  End Sub 第三种方法,比较有效,但自定义菜单和工具也将被删除:  1. 删除C:Documents and Settings用户名Application DataMicrosoftExcelXLSTART下的所有文件  2. 删除*.xlb文件,方法是:关闭excel----开始---搜索---输进“*.xlb”----搜索出这个文件删除它----重新启动excel。(留意,删除*.xlb文件也将删除所有工具栏和菜单栏的自定义设置! ) 一般在这里:C:Documents and Settings用户名Application DataMicrosoftExcel