2-Dimensional array with different data type columns


442 просмотра

1 ответ

Code: VBA

Suppose there's an 8 X 2 array, val(1 to 8, 1 to 2).

I want the first column to be of "String" type and the second column to be of "Long" type.

Is it possible to define such a 2-D array?

Автор: Vaibhav Miglani Источник Размещён: 08.11.2019 11:04

Ответы (1)

0 плюса

Dim A(8,2) As Variant

Arrays are all the same type.

Recordsets are tables. This reads a text file and puts a random number as a double and a string into each record.

Set rs = CreateObject("ADODB.Recordset")
With rs
    .Fields.Append "RandomNumber", 4 
    .Fields.Append "Txt", 201, 5000 
    Do Until Inp.AtEndOfStream
        .Fields("RandomNumber").value = Rnd() * 10000
        .Fields("Txt").value = Inp.readline
    .Sort = "RandomNumber"
    Do While not .EOF
        Outp.writeline .Fields("Txt").Value
End With
Автор: user6737723 Размещён: 20.08.2016 09:59
Вопросы из категории :