当前位置: 代码迷 >> Office >> word 中右键增添百度 搜索
  详细解决方案

word 中右键增添百度 搜索

热度:1936   发布时间:2013-02-26 00:00:00.0
word 中右键添加百度 搜索
Private Sub Document_Open() 
    On Error Resume Next 
    Dim BtnGoogle As CommandBarButton 
    Dim BtnBaidu As CommandBarButton 
    Application.CommandBars("Text").Controls("Google搜索").Delete   '预防性删除 
    Application.CommandBars("Text").Controls("Baidu搜索").Delete   '预防性删除 
    Application.CommandBars("Text").Reset '重新设置右键菜单,彻底恢复默认设置 
    Set BtnGoogle = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=1) '第一项 
    Set BtnBaidu = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=2) '第二项 
    With BtnGoogle 
      .Caption = "&Google搜索" '命令名称 
      .FaceId = 86             '命令的FaceId,字母G 
      .Visible = True           '可见 
      .OnAction = "GoogleSearch"       '指定响应过程名 
    End With 
    With BtnBaidu 
      .Caption = "&Baidu搜索" '命令名称 
      .FaceId = 81             '命令的FaceId 
      .Visible = True           '可见 
      .OnAction = "BaiduSearch"       '指定响应过程名 
    End With 
End Sub 


运行后word中确实有了 百度 谷歌
但是使用的时候说由于宏安全设置 无法找到宏 或宏被禁用
------解决方案--------------------------------------------------------
把宏安全性设成“低”
  相关解决方案