The Wise Owl logo (an owl and the company name)

Our training courses

Other training resources

Our training venues

Why we are different

Details for nielsjmp

nielsjmp has participated in the following threads:

Added by nielsjmp on 02 Jul 2025 at 20:26

Hi, thanks a lot for the tutorials. Im quite new in VBA but have used it to open data from a closed workbook containing a database with around 35 columns and some 15000 rows.

But I run into one weird problem that it took me some time to sort out. In my column no 13 I have some long text strings, worst case I think they can be up to 5000 characters. The recordset ("TableArr()") seems to be truncated to 255 characters. Is there a workaround on this, eventually specify the 13th column to be separately uploaded to an array with specified longer text strings?

I hope the question makes sense! Thanks again:-)

Dim Conn As ADODB.Connection

Dim PartNoRecordSet As ADODB.RecordSet

Dim DwgRecordSet As ADODB.RecordSet

Dim TableArr() As Variant

Dim RevNo As String, PartNo As String ', FirstRow() As String,

Dim PartNos() As String

Dim i As Long, j As Long, IdxDwgRev As Long, IdxPartNo As Long, NoOfRows As Long, NoOfCols As Long

ReDim PartNoDataBaseStr(1, 1)

ReDim FirstRow(1)

ReDim PartNoArr(1)

Set Conn = New ADODB.Connection

Set PartNoRecordSet = New ADODB.RecordSet

SheetName = "PartNoDB"

Conn.ConnectionString = _

"Provider=Microsoft.ACE.OLEDB.12.0;" & _

"Data Source=" & DataBaseDir & "\" & DatabaseFile & _

";Extended Properties='Excel 12.0 Macro;HDR=NO';"

Conn.Open

PartNoRecordSet.ActiveConnection = Conn

PartNoRecordSet.Source = "Select * from [PartNoDB$]"

PartNoRecordSet.Open

TableArr = PartNoRecordSet.GetRows 'TableArr includes Null values

NoOfCols = UBound(TableArr, 1)

NoOfRows = UBound(TableArr, 2)

ReDim PartNoDataBaseStr(NoOfCols, NoOfRows)

ReDim FirstRow(NoOfCols)

ReDim PartNoArr(NoOfRows)

'Cleaning up for Null values

For i = 0 To NoOfCols - 1

For j = 0 To NoOfRows - 1

If IsNull(TableArr(i, j)) Then

PartNoDataBaseStr(i, j) = vbNullString

Else

PartNoDataBaseStr(i, j) = TableArr(i, j)

End If

Next

Next

For i = 0 To NoOfCols - 1

FirstRow(i) = PartNoDataBaseStr(i, 0)

Next

For j = 0 To NoOfRows - 1

PartNoArr(j) = PartNoDataBaseStr(0, j)

Next

Head office

Kingsmoor House

Railway Street

GLOSSOP

SK13 2AA

London

Landmark Offices

99 Bishopsgate

LONDON

EC2M 3XD

Manchester

Holiday Inn

25 Aytoun Street

MANCHESTER

M1 3AE

Google reviews star logo

© Wise Owl Business Solutions Ltd 2025. All Rights Reserved.

End of small page here
Please be aware that our website uses cookies!
I'm OK with this Tell me more ...