![](/img/trans.png)
[英]Excel VBA SendKeys not working when trying to Send to Excel Add-In
[英]VBA Add-In Not Working
我有一個功能齊全的宏,我正在嘗試將其轉換為加載項,以便我可以在所有 excel 文檔中使用它。 但是我不能讓它創建一個菜單。 請幫忙。
第一件事:
我在運行 Mountain Lion 的 Mac 上使用 Office 2011-Excel
我的 .xlam 文件保存在正確的文件夾 Applications/Microsoft Office 2011/Office/Add-Ins
我已經使用工具/加載項菜單正確安裝了它
我的代碼位於 .xlam 文件的 This Worksheet 部分
我的加載項的源代碼可從所有文檔中查看
我的代碼如下:
Option Explicit
Dim cControl As CommandBarButton
Private Sub Workbook_Open()
On Error Resume Next 'Just in case
Application.CommandBars("Worksheet Menu Bar").Controls("P Wave").Delete 'Delete any existing menu item that may have been left.
Set cControl = Application.CommandBars("Worksheet Menu Bar").Controls.Add 'Add the new menu item and Set a CommandBarButton Variable to it
With cControl 'Work with the Variable
.Caption = "P Wave"
.Style = msoButtonCaption
.OnAction = "runSheet()"
'Macro stored in a Standard Module
End With
On Error GoTo 0
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next 'In case it has already gone.
Application.CommandBars("Worksheet Menu Bar").Controls("P Wave").Delete
On Error GoTo 0
End Sub
我無法顯示我的宏菜單。 請幫忙
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.