惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - hong

VBA访问word菜单 - hong - 博客园 RUP核心概念解析 RUP 核心概念 IBM Rational 技术文档下载 项目管理规范-RUP管理实施 感叹人生 遗憾 C#中的类型相等与恒等(Equality & Identity) Windows Vista workshop 理解抽象类和接口 线程概念 开始找工作了 BI理解 Web Service基础 改变人的一生的五句话 堆和栈的区别 在web页面中显示多页的tif文件 sql日期转换问题 Visual Studio Team System资源
VBA命令按钮操作 - hong - 博客园
hong · 2007-02-07 · via 博客园 - hong

1、添加一个命令按钮

Sub AddCommandBar()
'命令
Dim cbar  As CommandBarButton


Set cbar = CommandBars("Standard").Controls("临时按钮")

If Not cbar Is Nothing Then
    
Exit Sub
End If

    
With CommandBars("Standard")
        .Protection 
= msoBarNoProtection
        
        
With .Controls.Add(msoControlButton, Before:=3)
            .DescriptionText 
= "QuitWithoutSave"
            .Caption 
= "临时按钮"
            .TooltipText 
= "临时按钮"
            .Style 
= msoButtonIconAndCaption
            .OnAction 
= "QuitWithoutSave"
        
End With
    
    
End With
End Sub

Private Sub QuitWithoutSave()
    
MsgBox "激活事件:临时按钮"
End Sub

2、删除命令按钮

CommandBars("Standard").Controls("临时按钮").Delete

3   修改word命令

'修改word命令
Sub FileSave()

MsgBox ActiveDocument.Name

If ActiveDocument.Saved = False Then
    ActiveDocument.Save
End If

End Sub


Sub FileSaveAs()
    
MsgBox "您不能另存文档"
End Sub

 4、删除顶端菜单

 CommandBars.ActiveMenuBar.Controls("Custom").Delete