3 回答
TA贡献1856条经验 获得超17个赞
这适用于我在Excel和Word中
Sub runit()
Dim Shex As Object
Set Shex = CreateObject("Shell.Application")
tgtfile = "C:\Nax\dud.txt"
Shex.Open (tgtfile)
End Sub
或...按照下面的Expenzor的评论
CreateObject("Shell.Application").Open("C:\Nax\dud.txt")
TA贡献1869条经验 获得超4个赞
下面的代码是一个模板。但是,您可能需要将默认(工作)目录更新为文件的位置。
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpszOp As String, _
ByVal lpszFile As String, ByVal lpszParams As String, _
ByVal LpszDir As String, ByVal FsShowCmd As Long) _
Function StartDoc(DocName As String) As Long
Dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", DocName, _
"", "C:\", SW_SHOWNORMAL)
End Function
- 3 回答
- 0 关注
- 1450 浏览
相关问题推荐
添加回答
举报