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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert header comments in vb software

Status
Not open for further replies.

easycode

Programmer
Jan 28, 2005
195
US
Hello all,

I am almost done with a software that was developed in VB, for QA issues i need to insert header comments on each procedure of each form. I have over a hundred forms and an average of 10 procedures on each form, that means like 1000 comments on the vb software. Does anyone have the code to automatically add comments at the beggining of ech program.Any help is appreciated. Thanks

i.e.

'''''''''''''''''''''''''''''''''''''''''''''''''''
'Form:
'Description:
'Author:
'Preconditions:
'Assumptions:
'Inputs:
'Returns:
'Side Effects:
'Errors:
'''''''''''''''''''''''''''''''''''''''''''''''''''
 
Any advise is appreciated
Add a reference to Microsoft Visual Basic for Application Extensibility

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
thanks PHV for replying
Could you be more descriptive, i dont get it. What do you mean by Mic. VB for Application?

Thanks again
 
I you don't know how to add a reference nor what VBA is, I strongly discourage you to manipulate project's source with code.
 
Thanks to everyone who replied, your suggestions were useful, i am now working with the VBA Extensibility library it works just fine.


Thanks again
 
The next code works fine if i am in a module that has 1 procedure or more, but i would like to add coments to a different code of forms from this module. You will see a message 'HERE IS THE ERROR LINE". I need to change this line of code to make a reference not to the ActiveCodePane but for any other form or module. If any additional info is needed please let me know. thanks


Public Sub CommentProcedures()

Dim oVBE As VBIDE.VBE
Dim oCM As CodeModule
Dim iLines As Integer
Dim iCtr As Integer
Dim sProc As String
Dim sCtr As String

Set oVBE = Application.VBE
Set oCM = VBE.ActiveCodePane.CodeModule 'HERE IS THE ERROR

iLines = oCM.CountOfLines
' Create an array to hold the procedure names.
ReDim asProcs(iLines) As String

' Fill the array with the procedure names.
For iCtr = 1 To iLines
sProc = oCM.ProcOfLine(iCtr, vbext_pk_Proc)
asProcs(iCtr) = sProc
Next iCtr

sProc = ""


 
i re-read the last message and it does not look clearly.

let say i have a module called test and a form called form1, i have the procedure CommentProcedures()in module test.

Module test has
-CommentProcedures
-myprocedure
-infoprocedure

form1 has
-form_load procedure
-cmdbuttonok procedure
-function convert procedure

if i run the CommentProcedures from the Module test it will add comments to all 3 procedures that belong to this module, but i need to modify this Sub to make it add comments to Form1 in other words running from Module Test should add comments to all procedures in all forms.

Hope this helps

Thanks
 
Have a look at the VBProjects and VBComponents collections.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top