我在VBA中有一个Excel-2010的Addin。如果我从VBA编辑器执行代码,它可以正常工作。但是,当我使用为Addin生成的条带中的按钮执行宏时,它会抛出以下错误:Compile Error in Hidden Module: Module 1
我的代码:
Sub QE_eventhandler(control As IRibbonControl)
If MsgBox("Esta acción no se podrá deshacer. ¿Desea Continuar?", vbExclamation + vbOKCancel, "Confirmar -Quitar Espacios-") = vbOK Then
QuitaEspacios
End If
End
Sub QuitaEspacios()
Dim celda As Range
For Each celda In Selection
If TypeName(celda.Value) = "String" Then
celda.Value = Application.WorksheetFunction.Trim(celda.Value)
End If
Next
End Sub用自定义UI编辑器生成的代码:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="customTab" label="GARSA Tools">
<group id="customGroup1" label="Reformateo Texto">
<button id="customButton3" label="Quitar Espacios" size="large" onAction="QE_eventhandler" imageMso="TextEffectTracking" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>发布于 2015-03-12 11:40:06
在回调结束时,您丢失了一个End Sub --您只有End。
Sub QE_eventhandler(control As IRibbonControl)
If MsgBox("Esta acción no se podrá deshacer. ¿Desea Continuar?", vbExclamation + vbOKCancel, "Confirmar -Quitar Espacios-") = vbOK Then
QuitaEspacios
End If
End Sub发布于 2015-03-12 11:49:09
https://stackoverflow.com/questions/29008597
复制相似问题