Excel macros - Too many line continuations

excel, vba

Solution

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.

Problem

I have a "large" SQL query (like 200 lines)... ``` dim query as string query = "..................................." & _ "..................................." & _ .... Like a lot lines later... "..................................." function query,"sheet 1" ``` When I do this, Excel says "Too many line continuations." What is the best way to avoid this?

Original source