in a newly created VB6 exe in the IDE you get
Option Explicit
Private Sub Form_Load()
End Sub
if i run my addin i get the correct results.
ie
Option Explicit
Private Sub Form_Load()
My Inserted Text <<<<< This is my inserted code
End Sub
if however i add some lines of code and white space as follows
ie
Option Explicit
Dim test as string
<<Space
<<Space
<<Space
Private Sub Form_Load()
End Sub
Now if I run my Addin I get
Option Explicit
Dim test as string
<<Space
My Inserted Text <<< This should be inside the Form_Load
<<Space
Private Sub Form_Load()
End Sub
He is the code i use to find the Form_Load Procedure
Private Function FindStartPlace(ByVal Stext As String) As Long
On Error Resume Next
Dim strProcNameExisits As Boolean
Dim lngProcStartLine As Long
Dim lngProcLineCount As Long
'
strProcNameExisits =
VBInstance.CodePanes.VBE.ActiveCodePane.CodeModule.Find(Stext, 1, 1,
VBInstance.ActiveCodePane.CodeModule.CountOfLines, 0, False, False)
If strProcNameExisits = False Then Exit Function
lngProcStartLine =
VBInstance.CodePanes.VBE.ActiveCodePane.CodeModule.ProcStartLine(Stext,
vbext_pk_Proc)
FindStartPlace = lngProcStartLine + 2
End Function
This will see the number of lines of code but does not take into account the
Blank Lines with Nothing there
I hope someone can help
Many thanks
Garry
--
2025
If you do not believe in time travel,
your beliefs are about to be tempered.
http://www.facebook.com/group.php?gid=43606237254
"k_zeon" <silverm...@googlemail.com> wrote in message
news:OR2W82D...@TK2MSFTNGP03.phx.gbl...
You need to use ProcBodyLine instead of ProcStartLine. ProcStartLine gives
you the first line of a procedure that would include any header. This is the
same line that appear after the separator in the IDE. ProcBodyLine gives you
the actual Sub/Function/Property declaration line.
many thanks
"Nobody" <nob...@nobody.com> wrote in message
news:OOUPb7Fz...@TK2MSFTNGP02.phx.gbl...