My end goal is to be able to write the following code and have it work for reading data into and out of the object (Ptr2FieldData). I should point out that Coordinates is a property of Ptr2FieldData and is an object.
Ptr2FieldData.Coordinates.X
Here is what I am currently doing which is a step in the right direction, but does not get me to my goal. Thanks to xlNitWit, the code works:
FieldDataCoordinates.X = Ptr2FDWrkSht.Cells(Row, X_CoordinateColumn).value
FieldDataCoordinates.Y = Ptr2FDWrkSht.Cells(Row, Y_CoordinateColumn).value
Set Ptr2FieldData.Coordinates = FieldDataCoordinates
But if I attempt to consolidate the code, the compiler complains with error ‘91’ object variable not set. I know I must be misunderstanding something….please offer insight.
Ptr2FieldData.Coordinates.x = Ptr2FDWrkSht.Cells(Row, X_CoordinateColumn).value
Ptr2FieldData.Coordinates.y = Ptr2FDWrkSht.Cells(Row, Y_CoordinateColumn).value
Here is a shortened Ptr2FieldData Class containing only the critical Coordinate Property
Option Explicit
' MeasurementClass
Private PMeasurementCoordinates As CoordinatesClass
Public Property Set Coordinates(value As CoordinatesClass)
Set PMeasurementCoordinates = value
End Property
Public Property Get Coordinates() As CoordinatesClass
Set Coordinates = PMeasurementCoordinates
End Property
And here is the CoordinatesClass
Option Explicit
'CoordinatesClass
Private Px As Double
Private Py As Double
Public Property Let X(value As Double)
Px = value
End Property
Public Property Get X() As Double
X = Px
End Property
Public Property Let Y(value As Double)
Py = value
End Property
Public Property Get Y() As Double
Y = Py
End Property
Bookmarks