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.
我想在字符串“path”中存储一个路径,该路径可用于整个工作簿。
当我按照以下方式执行此操作时,出现错误:“无效的外部程序”
这是我尝试在(常规)(声明)中声明路径的方式
Option Explicit Dim path As String path = "\\sharedDrive\TestFolder\Test_PDF\"
我在以下位置收到错误:
"\\sharedDrive\TestFolder\Test_PDF\"
将变量放在模块中,如下所示:
Public path As String
然后,在您的 Workbook_Open 例程中:
Private Sub Workbook_Open() yourModule.path = "\\sharedDrive\TestFolder\Test_PDF\" End Sub
要在任何地方访问它,请使用yourModule.path.
yourModule.path