Last active
November 28, 2024 07:52
-
-
Save tdalon/3876eb7a386664f6afa37d845d90d3c7 to your computer and use it in GitHub Desktop.
Excel VBA global property example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private pLocalPath As String | |
Public Property Get LocalPath() As String | |
If pLocalPath = "" Then | |
pLocalPath = GetLocalPath(ThisWorkbook.Path) | |
End If | |
LocalPath = pLocalPath | |
End Property | |
' Using Property somewhere else in VBA - example | |
Function GetModuleLocalPath(Name As String, rel As String) As String | |
sRootDir = LocalPath & "\" & rel & "\" & Name | |
GetModuleLocalPath = sRootDir | |
End Function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' UDF Function to be called from Excel Sheet | |
Function GetProp_LocalPath() | |
GetProp_LocalPath = LocalPath | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See detailed explanation https://tdalon.blogspot.com/2024/11/excel-vba-global-property.html