首页 » Visual Basic » VB打开任意文件,通用执行代码

VB打开任意文件,通用执行代码

一般执行用shell ,但那个只支持可执行文件如exe的,比如pdf就不行,比如我们要打开网页,有时还要用ie做为参数形式来打开,太麻烦了。现在用这么两行代码搞定一切问题。

Private Sub Command1_Click()
    Dim Runo32 As String, F As String
    Runo32 = "rundll32.exe url.dll,FileProtocolHandler"
    F = "D:\新建 文本文档.txt" '修改此处:EXE,DOC html 网址 都行
    F = "http://zhidao.baidu.com/" '打开 网址
    F = "E:\soft2010\ESET_VC52_AUTOID_www.xp500.com.rar"'自动会用winrar打开
    Shell Runo32 & " " & Chr(34) & F & Chr(34), 1
End Sub

, , , ,

转发到新浪微博 转发到新浪微博

目前这篇文章有3条评论(Rss)

  1. nike zoom rival | #1
    05/17/2012 at 02:30

    I AM REALLY ADMIRE TALENT OF HOST. WANNA LEANR MORE FROM U./.

  2. payday loans | #2
    05/17/2012 at 06:39

    Where is the facebook like button ?

  3. motorola droid accessories | #3
    05/17/2012 at 08:07

    Oh my goodness! an amazing article dude. Thank you Nevertheless I am experiencing issue with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting similar rss drawback? Anybody who knows kindly respond. Thnkx

我要评论