I'm trying to return a Property Value in a function where the Property's name is supplied via another function that originates outside of the existing Project and this can be a random item, so setting it or calling it from outside the project will not work...
Here's what I've somewhat been tooling with
When I pass the value of "CustNAME" which is one of the properties in the existing project that was previously loaded with a value of let's say "Mike" I need to be able to request via a string and return the property value of "Mike".
Below are two of my attempts....
Private Function GetPropValue(strPropName) As String
On Error GoTo ErrorHandler
Dim ThisProj As ProjRampIT
Dim varProp As Property
Set ThisProj = CurrentProjRampit '=Current Obj
For Each varProp In ThisProj
If varProp.Name = strPropName Then
GetPropValue = varProp.Value
Exit Function
End If
Next
' If here then Property Requested is Invalid
GetPropValue = "ERR"
ExitHandler:
Exit Function
ErrorHandler:
DoEvents
TEST5 = Err.Description
Resume ExitHandler
End Function
-----------------OR------------------------------
Private Function GetPropValue(strPropName) As String
On Error GoTo ErrorHandler
Dim varProp As Property
For Each varProp In Properties
If varProp.Name = strPropName Then
GetPropValue = varProp.Value
Exit Function
End If
Next
' If here then Property Requested is Invalid
GetPropValue = "ERR"
ExitHandler:
Exit Function
ErrorHandler:
DoEvents
TEST5 = Err.Description
Resume ExitHandler
End Function
I continue to get returned the error message "Object Required.." well the object is the existing instance of
itself that I am inquiring into...?
Thanks in Advance for your help, Mike...
Here's what I've somewhat been tooling with
When I pass the value of "CustNAME" which is one of the properties in the existing project that was previously loaded with a value of let's say "Mike" I need to be able to request via a string and return the property value of "Mike".
Below are two of my attempts....
Private Function GetPropValue(strPropName) As String
On Error GoTo ErrorHandler
Dim ThisProj As ProjRampIT
Dim varProp As Property
Set ThisProj = CurrentProjRampit '=Current Obj
For Each varProp In ThisProj
If varProp.Name = strPropName Then
GetPropValue = varProp.Value
Exit Function
End If
Next
' If here then Property Requested is Invalid
GetPropValue = "ERR"
ExitHandler:
Exit Function
ErrorHandler:
DoEvents
TEST5 = Err.Description
Resume ExitHandler
End Function
-----------------OR------------------------------
Private Function GetPropValue(strPropName) As String
On Error GoTo ErrorHandler
Dim varProp As Property
For Each varProp In Properties
If varProp.Name = strPropName Then
GetPropValue = varProp.Value
Exit Function
End If
Next
' If here then Property Requested is Invalid
GetPropValue = "ERR"
ExitHandler:
Exit Function
ErrorHandler:
DoEvents
TEST5 = Err.Description
Resume ExitHandler
End Function
I continue to get returned the error message "Object Required.." well the object is the existing instance of
itself that I am inquiring into...?
Thanks in Advance for your help, Mike...