Message 1 of 4
Using a class to retrieve info from a CSV file.
Not applicable
05-18-2004
02:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
Following on from the great help I had from Bobby C. Jones, I'm getting this
problem:
The >> line is highlighting La.Name & giving the error:
Variable required - can't assign to this expression.
I've tested La.Name by putting a value into it & I've retrieved it
successfully, so the Class appears to be working OK.
I've looked in the help & this might be the problem, but I don't know how
to solve it:
"You used a function call or an expression as an argument to Input #, Let,
Get, or Put. For example, you may have used an argument that appears to be a
valid reference to an array variable, but instead is a call to a function of
the same name".
I've checked for functions called La - there aren't any.
Any ideas?
TIA
Dave F.
Sub UserForm_Initialize()
Dim FileNo As Integer
Dim La As LayerAttr
Dim LayerInfoList As Collection
Set LayerInfoList = New Collection
FileNo = FreeFile
Open "c:\dwgs\fx15\fxlayersCSV.txt" For Input As FileNo
Do While Not EOF(FileNo)
Set La = New LayerAttr
>> Input #FileNo, La.Name, La.Color, La.LineType
LayerInfoList.Add La, La.Name
Set La = Nothing
Loop ' eof
Close FileNo
End Sub
------------------------
This is the Class module named LayerAttr
------------------------
Option Explicit
Private m_Name As String
Private m_Color As String
Private m_LineType As String
Public Property Get Name() As String
Name = m_Name
End Property
Public Property Let Name(newName As String)
m_Name = newName
End Property
Public Property Get Color() As String
Color = m_Color
End Property
Public Property Let Color(newColor As String)
m_Color = newColor
End Property
Public Property Get LineType() As String
LineType = m_LineType
End Property
Public Property Let LineType(newLineType As String)
m_LineType = newLineType
End Property