k_zeon
2009-05-03 22:22:55 UTC
I would like to create an addin but am having some difficulties
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
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