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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| Public NomPath1 As String
Public Nom1 As String
Public NomFichier As String
Public oFld As Folder
Public oFl As File
Public oFSO1 As FileSystemObject
Dim AllProcess
Dim Process
Dim strFoundProcess
Dim documents1 As Document
Public Sub CheckBox1_Click()
End Sub
Public Sub CheckBox2_Click()
End Sub
Public Sub CommandButton1_Click()
strFoundProcess = False
NomPath1 = Feuil1.NomPath
Set oFSO1 = Feuil1.oFSO
Select Case CheckBox1.Value 'pour catia
Case Is = True
Set oFld = oFSO1.GetFolder(NomPath1)
For Each oFl In oFld.Files
If oFSO1.GetExtensionName(oFl) = "CATPart" Then
Set AllProcess = GetObject("winmgmts:") 'create object
For Each Process In AllProcess.InstancesOf("Win32_process") 'Get all the processes running in your PC
If (InStr(UCase(Process.Name), "CNEXT.EXE") = 1) Then
strFoundProcess = True
End If
Next Process
If strFoundProcess Then
Dim CATIA As Object
Set CATIA = GetObject("CATIA.Application")
Set documents1 = CATIA.Documents
Set document1 = documents1.Open(NomPath1) '<= Excel ne reconnaît pas le .Open
Else
MsgBox "Lancer Catia, puis ré-essayer"
End If
End If
Next oFl
Case Is = False
NomFichier = ""
Case Else
Exit Sub
End Select
Set AllProcess = Nothing
Select Case CheckBox2.Value 'pour pro-E
Case Is = True
If oFSO1.FolderExists(NomPath1) Then
Set oFld = oFSO1.GetFolder(NomPath1)
For Each oFl In oFld.Files
If oFSO1.GetAbsolutePathName(oFl) Like "*.prt*" Then
lancement = Shell("""C:\Program Files\proeWildfire 5.0\bin\proe.exe "" """ & NomPath1 & """", 1)
Exit For
End If
Next
Else
MsgBox "le composant PRO-E n'existe pas"
End If
Case Is = False
NomFichier = ""
Case Else
Exit Sub
End Select
End Sub
Public Sub CommandButton2_Click()
Unload Me
Exit Sub
Exit Sub
End Sub |
Partager