|
支持老版的菜单,位置在这
效果如上
右键菜单效果如上
代码如下:
function Application_WorkbookOpen(wk)
{
if(wk.Name==ThisWorkbook.Name){
let wmb=Application.CommandBars.ActiveMenuBar;
wmb.Reset();
let cmb1=wmb.Controls.Add({Type:msoControlButton,Temporary:true});
let cmp1=wmb.Controls.Add({Type:msoControlPopup,Temporary:true});
(obj=>{
obj.Caption="测试按钮1";
obj.Control.Style=3;
obj.Control.FaceId=446;
obj.OnAction="tone";
})(cmb1);
(obj=>{
obj.Caption="测试菜单1";
obj.OnAction="ttwo";
})(cmp1);
}
}
function tone(){
MsgBox("按钮已响应!",jsOKOnly,"信息")
}
function ttwo(){
MsgBox("菜单已响应!",jsOKOnly,"信息")
}
function Application_SheetBeforeRightClick(Sh, rg, cancel)
{
if(rg.Row==1 && rg.Column==1){
let db=Application.CommandBars("cell");
db.Reset();
let dbb1=db.Controls.Add({Type:msoControlPopup,Before:1,Temporary:true});
dbb1.Caption="浏览内置图标";
for (i=1;i<=2950;i++){
let dbb2=dbb1.Control.Controls.Add({Type:msoControlButton,Temporary:true});
dbb2.Caption=i;
dbb2.Control.FaceId=i;
}
}
}
|
评分
-
2
查看全部评分
-
|