Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1804|回复: 5

[已解决]这个Id是什么?

[复制链接]
发表于 2013-6-27 11:57 | 显示全部楼层 |阅读模式
本帖最后由 sdada 于 2013-6-27 12:36 编辑

With .Controls.Add(Type:=msoControlButton, Id:=2950)  
Id:=2950是什么?
最佳答案
2013-6-27 12:17
sdada 发表于 2013-6-27 12:13
Id和faceid有什么区别?

ID属性  是  内置控件序号
FaceID属性是CommandBarControl对象的图标属性
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2013-6-27 12:11 | 显示全部楼层
本帖最后由 那么的帅 于 2013-6-27 12:12 编辑

Id     Variant 类型,可选。指定内置控件的序号,

其中 2950   将在命令栏中添加一个  指定宏 对话框 的系统内置控件。


回复

使用道具 举报

 楼主| 发表于 2013-6-27 12:13 | 显示全部楼层
那么的帅 发表于 2013-6-27 12:11
Id     Variant 类型,可选。指定内置控件的序号,

其中 2950   将在命令栏中添加一个  指定宏 对话框 的 ...

Id和faceid有什么区别?
回复

使用道具 举报

发表于 2013-6-27 12:17 | 显示全部楼层    本楼为最佳答案   
sdada 发表于 2013-6-27 12:13
Id和faceid有什么区别?

ID属性  是  内置控件序号
FaceID属性是CommandBarControl对象的图标属性
回复

使用道具 举报

 楼主| 发表于 2013-6-27 12:19 | 显示全部楼层
那么的帅 发表于 2013-6-27 12:17
ID属性  是  内置控件序号
FaceID属性是CommandBarControl对象的图标属性

With .Controls.Add(Type:=msoControlButton, Id:=1)  
Id:=1是什么?

回复

使用道具 举报

发表于 2013-6-27 12:25 | 显示全部楼层
sdada 发表于 2013-6-27 12:19
With .Controls.Add(Type:=msoControlButton, Id:=1)  
Id:=1是什么?

每个ID对应的不用的控件,可以修改ID的值,具体查看
  1. Sub 添加指定内置控件到工具栏()    Dim customBar As CommandBar
  2.     Dim newButton As CommandBarButton
  3.     On Error Resume Next
  4.     CommandBars("Custom").Delete
  5.     Set customBar = CommandBars.Add("Custom")
  6.     With customBar
  7.         With .Controls.Add(Type:=msoControlButton, ID:=2950) '修改序号,可以看到具体调出的内置控件
  8.         End With
  9.         .Visible = True
  10.     End With
  11. End Sub

  12. Sub 删除指定工具栏()
  13.     On Error Resume Next
  14.     CommandBars("Custom").Delete
  15. End Sub
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-3 06:57 , Processed in 0.664269 second(s), 8 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表