在 C 中,标记的变量extern
只需要在本地声明,但可以在外部定义。VBA可以做到这一点吗?因此,我追求的是这样的:
DataSource_14.accdb:
' References CommonFunctions.accdb
Public SOURCE_ID As Long = 14
Public Sub Baz()
Foo
Bar
End Sub
CommonFunctions.accdb:
Extern SOURCE_ID As Long ' <- what's the proper way to declare this?
Public Sub Foo()
Debug.Print "Doing Foo stuff with source " & SOURCE_ID
End Sub
Public Sub Bar()
Debug.Print "Doing Bar stuff with source " & SOURCE_ID
End Sub