San*_*nya 13 directory excel vba excel-vba excel-2010
使用2010 Excel VBA - 我只是想通过sub打开一个文件夹.我在这做错了什么?
VBA
Sub openFolder()
Dim preFolder As String, theFolder As String, fullPath as String
theFolder = Left(Range("T12").Value, 8)
preFolder = Left(Range("T12").Value, 5) & "xxx"
fullPath = "P:\Engineering\031 Electronic Job Folders\" & preFolder & "\" & theFolder
Shell(theFolder, "P:\Engineering\031 Electronic Job Folders\" & preFolder, vbNormalFocus)
End Sub
Run Code Online (Sandbox Code Playgroud)
d-s*_*yer 31
如果要打开Windows文件资源管理器,则应调用explorer.exe
Call Shell("explorer.exe" & " " & "P:\Engineering", vbNormalFocus)
Run Code Online (Sandbox Code Playgroud)
等效的syxntax
Shell "explorer.exe" & " " & "P:\Engineering", vbNormalFocus
Run Code Online (Sandbox Code Playgroud)