Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Command1_Click() 'A ne pas oublier le: text1.MultiLine = True Text1.Text = "" Dim St As String Dim i As Long Open App.Path & "\Form1.frm" For Input As #1 Do While Not EOF(1) Line Input #1, St i = InStr(1, St, "Sub") If i > 0 And InStr(1, Left(St, i), "'") 0 Then 'InStr(1, Left(St, i), "'") 0 ==>> on ne prend pas en compte les commentaires If (InStr(1, St, "Private Sub") > 0 And i = 9) Or _ (InStr(1, St, "Public Sub") > 0 And i = 8) Or _ (InStr(1, St, "Friend Sub") > 0 And i = 8) Or _ (InStr(1, St, "Static Sub") > 0 And i = 8) Or _ i = 1 Then AfficheLeNom St, i + 4, "[Sub] " End If i = InStr(1, St, "Function") If i > 0 And InStr(1, Left(St, i), "'") 0 Then 'InStr(1, Left(St, i), "'") 0 ==>> on ne prend pas en compte les commentaires If (InStr(1, St, "Private Function") And i = 9) > 0 Or _ (InStr(1, St, "Public Function") > 0 And i = 8) Or _ (InStr(1, St, "Friend Function") > 0 And i = 8) Or _ (InStr(1, St, "Static Function") > 0 And i = 8) Or _ i = 1 Then AfficheLeNom St, i + 9, "[Fonction] " End If Loop Close End Sub Private Sub AfficheLeNom(Phrase As String, Debut As Integer, Genre As String) Text1.Text = Text1.Text & Genre & Mid(Phrase, Debut, (InStr(Debut, Phrase, "(") - Debut)) & vbCrLf End Sub
Private Sub Command1_Click() 'A ne pas oublier le: text1.MultiLine = True Text1.Text = "" Dim St As String Dim i As Long Dim FichIndex As Integer File1.Path = App.Path File1.Pattern = "*.frm;*.bas" For FichIndex = 0 To File1.ListCount - 1 Open File1.Path & "" & File1.List(FichIndex) For Input As #1 Do While Not EOF(1) Line Input #1, St i = InStr(1, St, "Sub") If i > 0 And InStr(1, Left(St, i), "'") 0 Then 'InStr(1, Left(St, i), "'") 0 ==>> on ne prend pas en compte les commentaires If (InStr(1, St, "Private Sub") > 0 And i = 9) Or _ (InStr(1, St, "Public Sub") > 0 And i = 8) Or _ (InStr(1, St, "Friend Sub") > 0 And i = 8) Or _ (InStr(1, St, "Static Sub") > 0 And i = 8) Or _ i = 1 Then AfficheLeNom St, i + 4, "[Sub] " End If i = InStr(1, St, "Function") If i > 0 And InStr(1, Left(St, i), "'") 0 Then 'InStr(1, Left(St, i), "'") 0 ==>> on ne prend pas en compte les commentaires If (InStr(1, St, "Private Function") And i = 9) > 0 Or _ (InStr(1, St, "Public Function") > 0 And i = 8) Or _ (InStr(1, St, "Friend Function") > 0 And i = 8) Or _ (InStr(1, St, "Static Function") > 0 And i = 8) Or _ i = 1 Then AfficheLeNom St, i + 9, "[Fonction] " End If Loop Close Next End Sub Private Sub AfficheLeNom(Phrase As String, Debut As Integer, Genre As String) Text1.Text = Text1.Text & Genre & Mid(Phrase, Debut, (InStr(Debut, Phrase, "(") - Debut)) & vbCrLf End Sub Sub Test1() Exit Sub End Sub Function Test2() Exit Function End Function Private Sub Command2_Click() Test1 End Sub
If i > 0 And InStr(1, Left(St, i), "'") = 0 Then
gaffe aux sub en commentaire, acive
gaffe aux sub en commentaire, acive
If (InStr(1, St, "Private Sub") > 0 And i = 9) Or _ (InStr(1, St, "Public Sub") > 0 And i = 8) Or _ (InStr(1, St, "Friend Sub") > 0 And i = 8) Or _ (InStr(1, St, "Static Sub") > 0 And i = 8) Or _ i = 1 Then AfficheLeNom St, i + 4, "[Sub] "
If i > 0 And InStr(1, Left(St, i), "'") = 0 Then
^(Private |Public |Global |Friend )? *\bSub +([A-Z][\w_@&$]+)