Can I paste rich text and preserve formatting?
Solution 1:
I just tested this with Visual Studio so it may slightly different from Eclipse. When you say text box I also assume you mean a single Excel cell. From Visual Studio Excel would only allow pasting of text. I then pasted the code into Word which preserves formatting and the highlighting. Copying the text from Word and then pasting into Excel seemed to preserve both the syntax and format.
I will say that while Excel can do a bunch of things it may not be the best tool to use for everything. It's hard to say without knowing more about your specific case but another tool might be better for preserving code format.