Link to home
Start Free TrialLog in
Avatar of mi5
mi5

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of caraf_g
caraf_g

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.