word右键添加百度谷歌搜索,word右键添加打开某个文件夹选项
2012-08-21 16:48
459 查看
http://wenku.baidu.com/view/56b5f87aa26925c52cc5bf14.html?st=1免积分下载教程
word -工具- 宏- 创建 - 添加下面代码,文件夹路径和浏览器路径自己修改
Private Sub Document_Close()
On Error Resume Next
Application.CommandBars("Text").Controls("Google搜索").Delete '恢复原有菜单
Application.CommandBars("Text").Controls("Baidu搜索").Delete '恢复原有菜单
Application.CommandBars("Text").Controls("work").Delete '恢复原有菜单
Application.CommandBars("Text").Reset '重新设置右键菜单,彻底恢复默认设置
End Sub
'----------------------
Private Sub Document_Open()
On Error Resume Next
Dim BtnGoogle As CommandBarButton
Dim BtnBaidu As CommandBarButton
Dim Btnfile As CommandBarButton
Application.CommandBars("Text").Controls("Google搜索").Delete '预防性删除
Application.CommandBars("Text").Controls("Baidu搜索").Delete '预防性删除
Application.CommandBars("Text").Controls("work").Delete '预防性删除
Application.CommandBars("Text").Reset '重新设置右键菜单,彻底恢复默认设置
Set BtnBaidu = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=1) '第一项
Set BtnGoogle = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=2) '第二项
Set Btnfile = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=3) '第三项
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
With Btnfile
.Caption = "&work" '命令名称
.FaceId = 85 '命令的FaceId
.Visible = True '可见
.OnAction = "CommandButton1_Click" '指定响应过程名
End With
End Sub
'----------------------
Sub GoogleSearch()
Dim sSearch$, sSel$
sSel = Trim(Selection.Text)
sSearch = "C:\Documents and Settings\Administrator\Local Settings\Application Data\360Chrome\Chrome\Application\360chrome.exe ""http://www.google.com.hk/search?client=Juncox&hl=zh-CN&q=" & sSel & """" '两种形式结果是一致的
' sSearch = "explorer " & Chr(34) & "http://www.google.cn/search?client=Juncox&hl=zh-CN&q=" & sSel & Chr(34)
Shell sSearch
End Sub
Sub BaiduSearch()
Dim sSearch$, sSel$
sSel = Trim(Selection.Text)
sSearch = "C:\Documents and Settings\Administrator\Local Settings\Application Data\360Chrome\Chrome\Application\360chrome.exe ""http://www.baidu.com/baidu?tn=Juncox&word=" & sSel & """"
' sSearch = "explorer " & Chr(34) & "http://www.baidu.com/baidu?tn=Juncox&word=" & sSel & Chr(34)
Shell sSearch
End Sub
Sub CommandButton1_Click()
mOpen = Shell("Explorer.exe E:\company\work\", vbNormalFocus)
End Sub
word -工具- 宏- 创建 - 添加下面代码,文件夹路径和浏览器路径自己修改
Private Sub Document_Close()
On Error Resume Next
Application.CommandBars("Text").Controls("Google搜索").Delete '恢复原有菜单
Application.CommandBars("Text").Controls("Baidu搜索").Delete '恢复原有菜单
Application.CommandBars("Text").Controls("work").Delete '恢复原有菜单
Application.CommandBars("Text").Reset '重新设置右键菜单,彻底恢复默认设置
End Sub
'----------------------
Private Sub Document_Open()
On Error Resume Next
Dim BtnGoogle As CommandBarButton
Dim BtnBaidu As CommandBarButton
Dim Btnfile As CommandBarButton
Application.CommandBars("Text").Controls("Google搜索").Delete '预防性删除
Application.CommandBars("Text").Controls("Baidu搜索").Delete '预防性删除
Application.CommandBars("Text").Controls("work").Delete '预防性删除
Application.CommandBars("Text").Reset '重新设置右键菜单,彻底恢复默认设置
Set BtnBaidu = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=1) '第一项
Set BtnGoogle = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=2) '第二项
Set Btnfile = Application.CommandBars("Text").Controls.Add(Type:=msoControlButton, Before:=3) '第三项
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
With Btnfile
.Caption = "&work" '命令名称
.FaceId = 85 '命令的FaceId
.Visible = True '可见
.OnAction = "CommandButton1_Click" '指定响应过程名
End With
End Sub
'----------------------
Sub GoogleSearch()
Dim sSearch$, sSel$
sSel = Trim(Selection.Text)
sSearch = "C:\Documents and Settings\Administrator\Local Settings\Application Data\360Chrome\Chrome\Application\360chrome.exe ""http://www.google.com.hk/search?client=Juncox&hl=zh-CN&q=" & sSel & """" '两种形式结果是一致的
' sSearch = "explorer " & Chr(34) & "http://www.google.cn/search?client=Juncox&hl=zh-CN&q=" & sSel & Chr(34)
Shell sSearch
End Sub
Sub BaiduSearch()
Dim sSearch$, sSel$
sSel = Trim(Selection.Text)
sSearch = "C:\Documents and Settings\Administrator\Local Settings\Application Data\360Chrome\Chrome\Application\360chrome.exe ""http://www.baidu.com/baidu?tn=Juncox&word=" & sSel & """"
' sSearch = "explorer " & Chr(34) & "http://www.baidu.com/baidu?tn=Juncox&word=" & sSel & Chr(34)
Shell sSearch
End Sub
Sub CommandButton1_Click()
mOpen = Shell("Explorer.exe E:\company\work\", vbNormalFocus)
End Sub
相关文章推荐
- 给右键菜单添加“复制 到文件夹”和“移动到文件夹“选项
- 利用注册表在右键添加VS15的快捷方式打开文件夹
- Windows操作系统下给文件夹右键命令菜单添加启动命令行的选项
- winXP右键菜单添加“打开所在文件夹”功能
- ubuntu系统右键菜单添加【当前路径打开终端】选项
- Ubuntu14.04右键菜单添加Sublime 2打开选项
- Windows 如何在右键中添加“在此处打开CMD窗口”选项
- VS2008在资源管理器中按右键添加ASP文件夹时没有App_Code选项,自行新增后放在里面的类文件不能调用!
- 为文件夹添加右键打开命令窗口功能
- windows右键添加CMD命令打开文件夹
- ckfinder.net完全讲解二(添加文件夹右键餐单选项)
- 【转载】为文件夹右键添加cmd打开命令
- 添加右键操作:当前路径打开cmd, 添加用Notepad++打开文件, 删除.svn文件夹, 修改IE查看源文件编辑器
- Win10文件夹/explorer空白处,右键菜单添加cmd打开,win10右键菜单修改
- ubuntu16.04 xfce4的鼠标主题设置为oxygen-red、修改文件夹背景颜色、两处系统字体设置、右键菜单添加压缩解压选项
- 文件夹右键添加cmd打开命令
- XP右键菜单添加“打开所在文件夹”功能
- 对文件夹右键菜单添加在此打开命令行
- 右键添加"用vim打开"文件选项
- 如何添加鼠标右键打开文件夹