LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code to write out all lines of code


The following code (C.Pearson's with a tweak or two to suit my purposes
serves me well to list all procedures in a module.

Sub ListProcedures1nALLModulesInWBook()

Dim VBCodeMod As CodeModule
Dim vc As VBComponent
Dim StartLine As Long
Dim Msg As String
Dim ProcName As String
Cells.Clear

k = 1
For Each vc In ThisWorkbook.VBProject.VBComponents
If vc.Type = vbext_ct_StdModule Or vc.Type = vbext_ct_ClassModule O
vc.Type = vbext_ct_MSForm Or vc.Type = vbext_ct_Document Then
Set VBCodeMod
ThisWorkbook.VBProject.VBComponents(vc.Name).CodeM odule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine = .CountOfLines
Msg = Msg & .ProcOfLine(StartLine, vbext_pk_Proc)
StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Cells(k, 1) = Msg
Cells(k, 2) = vc.Name
Cells(k, 3) = vc.Type
Cells(k + 1, 4) = .ProcCountLines(.ProcOfLine(StartLine
vbext_pk_Proc), vbext_pk_Proc) & " Lines"
k = k + 1
Msg = ""
Loop
End With
End If
Next
[a:j].Columns.AutoFit
End Sub

I want to take a step further and get a code to reproduce all th
lines of the procedures (in a project modules) on one worksheet. I hav
serached in vain for this facility, having failed to re-tool Mr
Pearson's code to *"list all lines*" and not just the titles.

A half-way house, is to export the modules as txt.files. But thi
approach is ungainly and ponderous as it sets up the arduous task o
having to combine the codes from fragmented text files.

I welcome anuy help.

Davi

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=39271

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write code to insert multiple lines Frantic Excel-er Excel Discussion (Misc queries) 0 June 17th 05 12:13 AM
Write a code by code Excel Discussion (Misc queries) 1 March 23rd 05 02:34 PM
Write a code with another code JJ[_7_] Excel Programming 5 March 23rd 05 02:23 PM
How can i write TSR code A-Design Excel Programming 5 September 29th 04 05:26 PM
Using VBA to Write VBA code SB Excel Programming 10 January 23rd 04 02:01 PM


All times are GMT +1. The time now is 06:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"