>Hi Cetin,
>
>Thanks, but I decided to go with Michel's SQL idea.
>But I'd like to replace the 'copy (filename) to xl5.' Can I use this code? Is there anything you'd change?
>
>Luke
But the one I sent is already based on SQL idea :) SQL is the easy part, sending the result to excel is the tricky part.
You cannot use copy to with Excel anymore (unless you mean simple, small tables that copy to can handle too). The code I sent works with even for 64 bits excel.
PS: That code with slight modification also works with cursor(s).