Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing VB Code

Status
Not open for further replies.

MRBURGE

Programmer
Mar 10, 2004
7
GB
My manager has requested that i print all the code from a project that i have been ask to complete.
The code contains many comments, but when i print it out the comments print in the same colour, which makes them unreadable
Is there any way i can print the comments in the colour that they appear on the screen????

PLEASE HELP
 
You simply can't print all your project code- VB isn't that sort of language. For example, frames behind other frames won't show on a simple printout - neither will all your design time properties on controls etc...

If you only want to print actual lines of text code, you might consider downloading a text editor that supports syntax highlighting, and then configure it appropriately...

Why do you need a paper print out anyway?

mmilan
 
He wants to keep a copy in a file for storage. (I don't know why)

I have a friend that is willing to take a look at the code but doesn't have VB so i wanted to send him a copy with the comments highlighted.

If you think it can't be done then i thank you for your help.
 
There are a number of VB code print utilities available. Google gives several on the first page of 'vb code print'

Please read faq222-2244 to get the best from the forum, particularly paragraphs 8 and 10.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Do you want to include the code behind the controls in forms that shows design time information like .Left, .Height properties etc? If so, you need to print the .frm & .bas files in full rather than attempt to do so from VB or cut & paste from VB. You should be able to load and print them from Wordpad or another editor. This does not address your colour issue though.

You could print the code from within code and detect normal comment lines via the condition

if left(trim(CodeLine),1)="'" then

which would trap all stand-alone single comment lines but if you have multi-line comments or executable lines with comments at the end of the line, trapping these would be more challenging.

If it were a very small project, you could just do a series of screen dumps & paste into Word as you scroll through.

Perhaps you should suggest to your boss that he stores a CD in an A4 plastic wallet within his file for storage - it would be a lot more useful than a hard copy and could save you some unnecessary effort.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top