Saving VB form code to Word format , retaining colours

I need to save my VB code from a form to Word 98 format for some documentation. I need to retain the blue and green colouring used by VB. As VB adds the colours itself, I can't just copy it to the clipboard, as it turns out all black. Any ideas?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Unless you do a "screen capture" you're going to have to color the text yourself...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hitching a ride...

I don't know the solution, but I can make a suggestion, perhaps..

The way I would approach this is to use the object interface to word. Then I would open the VB document as a text document.

You could then read in the VB file line by line.

You'll need to find the first single quote ' outside a pair of double quotes. That'll be the beginning of a comment.

Make sure you process the line continuation characters _

Now you can accurately colour lines or parts of lines green (comments)

The blue colour is going to be a lot more difficult. You may have to make a list of VB reserved keywords etc to achieve this with any degree of accuracy.

All in all, I do not think this is going to be an easy task.
Source Code Printing Demo Program
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.