I have written VBA code to be executed from Excel macro to go out and connect to a remote database and fill a spread sheet with the data returned by the query.

The following code works if my rs.Open string is less than 255 characters but fails when the sql string is longer than 255 characters.
Do anyone know of a work around or an alternative approach?

Dim db As Connection
Set db = New Connection

db.CursorLocation = adUseClient
db.Open "DB2", "userid", "password"
Set rs = New Recordset

rs.Open "SELECT * from sometable ", db

Dim myRow
Dim myColumn

myRow = 1
myColumn = 1

Do Until rs.EOF
For Each fld In rs.Fields
Worksheets("Sheet1").Cells(myRow, myColumn).Value = fld.Value
myColumn = myColumn + 1
Next fld

myRow = myRow + 1
myColumn = 1