使用VBA Shell命令运行另一个应用程序 [英] Using the VBA Shell command to run another application

查看:560
本文介绍了使用VBA Shell命令运行另一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sub BookShelf()


'在Microsoft Word 2007中选择光标处的单词

SendKeys" ^ + {right}" ,True

SendKeys" ^(c)",True


Dim retVal As Double

Dim bshel​​f As String


bshel​​f =""" C:\ BOOKSHELF 2000 \BSHELF \ BSHELF2K.EXE"" -c"


retVal = Shell(bshel​​f,SW_NORMAL)


AppActivate(" MICROSOFT BOOKSHELF 2000")


'访问BookShelf应用程序中的工具菜单

SendKeys"%T",True


'访问QuickDefine菜单项



SendKeys" {DOWN},True

SendKeys" {ENTER},True


'粘贴单词这里是
SendKeys" ^ V",True


'QuickDefine对话框应弹出单词定义

'而不是我得到"您的搜索不完整。 确保您选择了一个单词..."

'如何将所选单词传递到此窗口?


 


 


End Sub


 

解决方案


请尝试VBA论坛。>>


http://social.msdn.microsoft.com/论坛/ en-US / isvvba / threads


或WordDEV论坛。>>


http://social.msdn.microsoft。 com /论坛/ en-US / worddev / threads


 


social.answers
。>>


http://social.answers.microsoft.com/Forums/en-US/category/ officeword


 


social.technet
。>>


http://social.technet.microsoft。 com /论坛/ en-US / 字/主题


 


 


最后,这里也是VBA上的一个外部(独立论坛)区域:>>


http://www.programmersheaven.com/mb/vba/Board.aspx


 


Sub BookShelf()

'Select a word at the cursor in Microsoft Word 2007
SendKeys "^+{right}", True
SendKeys "^(c)", True

Dim retVal As Double
Dim bshelf As String

bshelf = """C:\BOOKSHELF 2000\BSHELF\BSHELF2K.EXE"" -c"

retVal = Shell(bshelf, SW_NORMAL)

AppActivate("MICROSOFT BOOKSHELF 2000")

'Access the Tool menu in the BookShelf application
SendKeys "%T", True

'Access the QuickDefine menu item

SendKeys "{DOWN}, True
SendKeys "{ENTER}, True

'Paste the word here
SendKeys "^V", True

'The QuickDefine dialog box should pop up with the word definition
'Instead I get "Your search is incomplete.  Make sure you have a word selected ..."
'How do I pass the selected word to this window?

 

 

End Sub

 

解决方案

Hi,

Please try the VBA forum.>>

http://social.msdn.microsoft.com/Forums/en-US/isvvba/threads

or the WordDEV forum.>>

http://social.msdn.microsoft.com/Forums/en-US/worddev/threads

 

or the last forum in this area on social.answers .>>

http://social.answers.microsoft.com/Forums/en-US/category/officeword

 

or this forum area on social.technet .>>

http://social.technet.microsoft.com/Forums/en-US/word/threads

 

 

Finally, here is an external ( independent forum ) area on VBA too:>>

http://www.programmersheaven.com/mb/vba/Board.aspx

 


这篇关于使用VBA Shell命令运行另一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆