Excel macros - Too many line continuations

Split the query into several sections:

query = _
  "............" & _
  "............" & _
  "............"
query = query & _
  "............" & _
  "............" & _
  "............"
query = query & _
  "............" & _
  "............" & _
  "............"

There's only one way -- to use less continuations.

This can be done by putting more text on a line or by using concatenation expressed differently:

query = ".........."
query = query & ".........."
query = query & ".........."

But the best is to load the text from an external source, as a whole.


So far I found this...

Call AddToArray(query, "...")
Call AddToArray(query, "...")
... a lot lines later...
Call AddToArray(query, "...")

*edit: Forgot to add:

Sub AddToArray(myArray As Variant, arrayElement As Variant)

If Not IsArrayInitialized(myArray) Then
    ReDim myArray(0)
    myArray(0) = arrayElement
Else
    ReDim Preserve myArray(UBound(myArray) + 1)
    myArray(UBound(myArray)) = arrayElement
End If

End Sub

Source: link text X( thankyou

(Still waiting for better ways to do this...) thankyou :P

Tags:

Excel

Vba