Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 vba 代码,用户需要在其中提供文件的路径。我知道客户端将需要处理许多文件,并且输入路径效率不高,并且可能会引入错误。我想知道是否有人知道我在哪里可以找到一个 vba 代码,该代码将打开一个窗口(面板或其他),用户可以在其中指向正确的文件(比如当我们在 90% 的应用程序中打开文件时)谢谢您的帮助
你可以;
Dim file As String With Application.FileDialog(3) .InitialFileName = "c:\xxx\" .Filters.Add "Text Files", "*.txt", 1 .Show If (.SelectedItems.Count) Then file = .SelectedItems(1) End If End With MsgBox file