我们办公室有人给Ctrl+D分配了一个宏。这是令人沮丧的,因为它已经在Excel中有一个功能。
Excel使您可以轻松地在Developer> Macros中分配宏,并且我知道,如果我在此菜单中推送选项,我可以看到在何处分配了哪些键。此工作簿中的宏列表相当大,我不想分别打开每个宏。
这列在哪里?我想这里应该有根木头吧?这是最接近我能找到的msdn,但我需要宏分配在一个macroworkbook: https://msdn.microsoft.com/en-us/library/hh179479(v=nav.90).aspx
感谢@GSerg指出这一点,为了完整地结束这个问题,我将在这里发布这篇文章。来源在这里:
https://groups.google.com/forum/!主题/microsoft.public.excel.worksheet.functions TwcT-IlWjVk
To use this Macro (Sub), <alt-F8> opens the macro dialog box. Select the macro by name, and <RUN>.
===================================================
Option Explicit
'MUST set to Trust Access to the VBA Project Object Model
' in Excel Options
'Set reference to:
'Microsoft Visual Basic for Applications Extensibility
'Microsoft Scripting Runtime
'Microsoft VBScript Regular Expressions 5.5
Sub ListMacroShortCutKeys()
Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As CodeModule
Dim LineNum As Long
Dim ProcKind As VBIDE.vbext_ProcKind
Dim sProcName As String, sShortCutKey As String
Const FN As String = "C:TempTemp.txt"
Dim S As String
Dim FSO As FileSystemObject
Dim TS As TextStream
Dim RE As RegExp, MC As MatchCollection, M As Match
Set RE = New RegExp
With RE
.Global = True
.IgnoreCase = True
.Pattern = "Attributes+(w+).VB_ProcData.VB_Invoke_Func = ""(S+)(?=\)"
End With
Set FSO = New FileSystemObject
Set VBProj = ActiveWorkbook.VBProject
For Each VBComp In VBProj.VBComponents
Select Case VBComp.Type
Case Is = vbext_ct_StdModule
VBComp.Export FN
Set TS = FSO.OpenTextFile(FN, ForReading, Format:=TristateFalse)
S = TS.ReadAll
TS.Close
FSO.DeleteFile (FN)
If RE.Test(S) = True Then
Set MC = RE.Execute(S)
For Each M In MC
Debug.Print VBComp.name, M.SubMatches(0), M.SubMatches(1)
Next M
End If
End Select
Next VBComp
End Sub
==============================
按ALT+F11进入项目模块。你可以在这里找到vba宏编码的快捷方式。如果你想保留它,那么不需要这样做,否则你可以选择所有和删除,保存和关闭文件。