我正在研究一些需要存储大量数据的代码,我想为这些代码编写一个新的数据类型。
Private Sub CommandButton1_Click()
Dim myFile As String, text As String
myFile = Application.GetOpenFilename()
Open myFile For Input As #1
Do Until EOF(1)
Line Input #1, text
'Check to see if line contains name
If InStr(text, "name=") <> 0 Then
'Trim down to just name
text = Replace(text, "name=", "")
text = Trim(text)
'Set the current value of text as name of new scalarIn
Dim text As scalarIn
End If
Loop
End Sub
我认为这不起作用,但更多的是帮助理解这个想法。我想要发生的是从文件中读取名称并将其设置为我的自定义数据类型的新实例的名称。
Public Type scalarIn
UnitOfMeasure As String
Value As Variant
Source As String
End Type