Originally Posted by
silvergraphite458961
I am working on the attached layer generator, but can't seem to get it to load the layers. I think I am missing something in the code. Can anyone help? Thanks!
What I've found at the quick glance:
I changed declaration at the start of project:
dim ColAr as Variant
because of any colors is in format RGB, not integer
- I see your layer names have an extrafluous blank spaces
- I've changed your sub to avoid getting an empty string:
Code:
Public Sub UpdateLabels()
On Error Resume Next
Close #1
For j = LBound(LayNameAr) To UBound(LayNameAr)
If LayNameAr(j) = ListBox1.Text Then
LTypLabel.Caption = "Linetype: " & vbCrLf & LTypeAr(j)
Label4.Caption = "Layer Description :" & vbCrLf & LayDescAr(j)
Open "C:\Windows\Temp\AugiLayerColors.txt" For Input As #1
rw = 1
Do While Not (EOF(1))
Line Input #1, MyVar
SplitItemVariant = Split(MyVar, ",")
If MyVar <> "" Then
ReDim ColAr(j)
If SplitItemVariant(0) = ColAr(j) Then
TextBox2.BackColor = RGB(SplitItemVariant(1), SplitItemVariant(2), SplitItemVariant(3))
TextBox2.Text = ColAr(j)
GoTo LabelsUpdated
End If
End If
Loop
End If
Next
LabelsUpdated:
End Sub