gpt4 book ai didi

vba - Excel VBA 打开文件夹

转载 作者:行者123 更新时间:2023-12-01 17:53:51 25 4
gpt4 key购买 nike

使用 2010 Excel VBA - 我只是想通过子文件夹打开一个文件夹。我在这里做错了什么?

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

最佳答案

如果你想打开Windows文件资源管理器,你应该调用explorer.exe

Call Shell("explorer.exe" & " " & "P:\Engineering", vbNormalFocus)

等效语法

Shell "explorer.exe" & " " & "P:\Engineering", vbNormalFocus

关于vba - Excel VBA 打开文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17426704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com