[英]Open file in vba Excel environment
我将使用此代码打开文件。 但这似乎是我最后一行的错误(myShell.Run“ path”)。
我的代码:
Sub open_path()
Dim path As String
path = ActiveCell.Value
Dim myShell As Object
Set myShell = CreateObject("WScript.Shell")
myShell.Run "path" 'this line is error
End Sub
我可以将地址指定为变量吗?
尝试以下修复
Sub open_path()
Dim path As String
path = ActiveCell.Value
Dim myShell As Object
Set myShell = CreateObject("WScript.Shell")
myShell.Run Chr(34) & path & Chr(34)
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.