CREdit list - http://www.geocities.com/plamen_p/credit/index.html

--------------------------- ListBot Sponsor --------------------------
Start Your Own FREE Email List at http://www.listbot.com/links/joinlb
----------------------------------------------------------------------

Hi there!

For question number 2 I've written a small vb macro that duplicates
the current document to a new one and adds the line number to each line.
If you print this file, you've just got what you want.

regards,
Benjamin

'---------------------------------------------------------------------------
----
Public Sub AddLineNumbers()
'---------------------------------------------------------------------------
----
'Duplicates the current file and adds the appropriate linenumber to the 
'beginning of each line
Dim cl,cc
Dim cLines
Dim hi,i
Dim nLen

        'Save current psotion in active file
        cl=ActiveDocument.Selection.CurrentLine
        cc=ActiveDocument.Selection.CurrentColumn
        
        'Get teh text of active file and split to lines
        Application.ActiveDocument.Selection.SelectAll
        clines=Split(ActiveDocument.Selection.Text,vbcrlf)
        'Restore position in active document
        ActiveDocument.Selection.MoveTo cl,cc
        
        'Determine last line and numberlength of each line, to make every
line
        'number the same legth, by adding leading zero
        hi=ubound(clines)
        nLen=len(hi+1)
        

        'Add the line number to each line
        for i=0 to hi
                If len(i+1)<nLen then
                        cLines(i)=string(nlen-len(i+1),"0") & i & ": " &
clines(i)
                Else
                        cLines(i)=i+1 & ": " & clines(i)
                End if
        next
        
        'Create new document and insert the 
        Documents.Add().Selection.Text=Join(clines,vbcrlf)


End Sub
'---------------------------------------------------------------------------
----


-----Original Message-----
From: Brendel, Rob [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 6:35 PM
To: 'CREdit list '
Subject: A few questions ...


CREdit list - http://www.geocities.com/plamen_p/credit/index.html

--------------------------- ListBot Sponsor --------------------------
Start Your Own FREE Email List at http://www.listbot.com/links/joinlb
----------------------------------------------------------------------

 I've been using CREdit for a couple months and really like it, especially
the ability to put comments in italics -- really makes it easy for my eye to
jump over them to the meat of my programs.  Thanks for making this
available.

A couple quetions:

(1) Is there a word wrap feature like in MS Notepad?  I'd like this when I
type text documents as opposed to programs, but I haven't found it.

(2) Can the line numbers be printed?  I like to see them on the screen, and
it would be great to print them, too.

Thanks for any hints or help,
Rob Brendel


______________________________________________________________________
To unsubscribe, write to [EMAIL PROTECTED]


______________________________________________________________________
To unsubscribe, write to [EMAIL PROTECTED]

Reply via email to