'This file is distributed "as is", e.g. there are no warranties 'and obligations and you could use it in your applications on your 'own risk. Although your comments and questions are welcome. ' 'Author: (c) Dan Kozub, 1999 'URL : http://DanKozub.com 'Email : mail@DanKozub.com 'Last Modified: Feb 10,2000 'Version: 1.1 'Copy contents of this file to the existing macro file 'OR add this file to list of macro files (Tools\Macro\Options>>\Loaded Files) Dim AutoContents_GoFrom Dim AutoContents_GoTo sub CreateAutoContents() set sel = ActiveDocument.Selection insert_position = sel.CurrentLine sel.StartOfDocument ExecuteCommand "WBGoToNext" first_line= sel.CurrentLine count = 1 prev = -1 do ExecuteCommand "WBGoToNext" cur_line= sel.CurrentLine if cur_line <= first_line then exit do count = count +1 loop text = "/* AutoContents generated "+Cstr(Date())+","+Cstr(Time())+vbCrLf sel.StartOfDocument for i=1 to count ExecuteCommand "WBGoToNext" cur_line= sel.CurrentLine line_text = left(sel.Text,len(sel.Text)-1) '----- new for v.1.1 '--- disabling comments line_text = Replace(line_text,"/*","/ *") line_text = Replace(line_text,"*/","* /") '--- insert 2 tabs before arguments line_text = Replace(line_text,"(",Chr(9)+Chr(9)+"(") '--- arguments from the new line 'uncomment next line to try 'line_text = Replace(line_text,"(",Chr(13)+Chr(9)+Chr(9)+Chr(9)+Chr(9)+Chr(9)+Chr(9)+"(") '--- insert 2 tabs before function name 'uncomment next line to try 'line_text = Replace(line_text,"::","::"+Chr(9)+Chr(9)) 'Printing the same info to the 'macro' page of the output window PrintToOutputWindow ActiveDocument.FullName +"("+cstr(cur_line+count+2)+") : "+line_text '----- new for v.1.1 if (len(line_text)<80) then line_text = line_text+space(80-len(line_text)) text = text + line_text+" "+cstr(cur_line+count+2)+vbCrLf next text = text +"*/"+vbCrLf sel.gotoline insert_position sel.Text = text end sub sub AutoContentsGo() set sel = ActiveDocument.Selection sel.SelectLine if Len(sel.Text)=2 then CreateAutoContents : Exit Sub sel.EndOfLine sel.WordLeft dsExtend text = sel.Text lline = sel.CurrentLine if AutoContents_GoTo<>0 and lline >= AutoContents_GoTo then sel.StartOfDocument sel.GotoLine AutoContents_GoFrom AutoContents_GoTo = 0 Exit sub end if AutoContents_GoFrom = lline On Error Resume Next lline = CLng(text) if Err.Number <> 0 then sel.StartOfDocument else sel.EndOfDocument sel.GotoLine lline AutoContents_GoTo = lline end if end sub sub BookmarkOut() set sel = ActiveDocument.Selection if sel.Text = "" then sel.StartOfLine sel.EndOfLine dsExtend line_text = sel.Text sel.StartOfLine else line_text = sel.Text end if PrintToOutputWindow ActiveDocument.FullName +"("+cstr(sel.CurrentLine)+") : "+line_text end sub