壳牌功能 [英] Shell Function
问题描述
我在Visual Basic项目中使用SHELL函数来启动程序文件,如Word,Excel等。我使用以下方式的函数:
Shell C:\Program Files \ Microsoft Office \ Office \ FRONTP.EXE,vbMaximizedFocus
如果指定的文件不存在,则没有任何迹象。是否有一些错误处理方法可用于通过msgbox或文件不存在的方式提醒用户?
我在Visual Basic项目中使用SHELL函数来启动程序文件,例如Word,Excel等。我正在以下列方式使用该函数:
Shell" C:\Program Files \ Microsoft Office \ Office \\ [FRONTP.EXE",vbMaximizedFocus
如果指定的文件不存在,则没有任何指示这样。是否有一些错误处理方法,我可以用来通过msgbox或文件不存在的东西提醒用户?
hi
如果不是DIR(C:\Program Files \ Microsoft Office \ Office \ FRONTP.EXE",0)= vbNullString然后
''文件存在,你可以继续
如果不是DIR(C:\Program Files \ Microsoft Office \ Office \ FRONTP.EXE,0)= vbNullString然后
''文件存在,你可以继续
只是一个注意事项 - 如果您使用VB6,那么我相信Shell功能或多或少已过时。我不记得它到底应该如何工作,但是给我几个小时(刚刚开始工作),我会在午休期间跟踪它。
< blockquote>如果SHELL不成功,则返回零
I am using the SHELL function in a Visual Basic Project to launch program files, such as Word, Excel, etc. I am using the function in the following way:
Shell "C:\Program Files\Microsoft Office\Office\FRONTP.EXE", vbMaximizedFocus
If the specified file does not exist there is no indication of such. Is there some method of error handling that I can use to alert the user via a msgbox or something that the file does not exist?
I am using the SHELL function in a Visual Basic Project to launch program files, such as Word, Excel, etc. I am using the function in the following way:
Shell "C:\Program Files\Microsoft Office\Office\FRONTP.EXE", vbMaximizedFocus
If the specified file does not exist there is no indication of such. Is there some method of error handling that I can use to alert the user via a msgbox or something that the file does not exist?hi
If Not DIR("C:\Program Files\Microsoft Office\Office\FRONTP.EXE",0)=vbNullString then
'' file exist, you may proceed
If Not DIR("C:\Program Files\Microsoft Office\Office\FRONTP.EXE",0)=vbNullString then
'' file exist, you may proceedJust a note - if you''re using VB6 then I believe the Shell function is more or less obsolete. I don''t recall exactly how it''s supposed to work now, but give me a few hours (just started work) and I''ll track it down during my lunch break.
If SHELL is unsuccessful it returns a zero
Expand|Select|Wrap|Line Numbers
这篇关于壳牌功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文