Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
463 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
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';"
PartNoRecordSet.ActiveConnection = Conn
PartNoRecordSet.Source = "Select * from [PartNoDB$]"
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
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2025. All Rights Reserved.