1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Sub tt()
Dim stChemin, stNomFichier(1), stUrl As String
stChemin = "C:\tt\"
stNomFichier(0) = "toto"
stNomFichier(1) = "fils"
stExtenstion = ".frm"
bt = bIsDejaOuvert(stNomFichier(0))
If Not bt Then
For i = 0 To 1
stUrl = stChemin & stNomFichier(i) & stExtenstion
ThisWorkbook.VBProject.VBComponents.Import (stUrl)
Next
End If
toto.Show
End Sub
Function bIsDejaOuvert(ByVal stFileName As String) As Boolean
'Fonction ok !
bIsDejaOuvert = False
With ThisWorkbook.VBProject.VBComponents
i = 1
While (i <= .Count) And bIsDejaOuvert = False
If LCase(.Item(i).Name) = LCase(stFileName) Then bIsDejaOuvert = True
i = i + 1
Wend
End With
End Function |
Partager