1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Private Sub Workbook_Open()
Dim macmdline As Variant
Dim monparam As Variant 'déclare une variable
macmdline = GetCmd 'affecte la valeur de la ligne de commande
If Not IsNull(macmdline) Then 'si la variable est nulle
If Len(macmdline) > 0 Then 'on s'assure qu'il y a eu une ligne de commande passée
If InStr(macmdline, "/cmd") > 0 Then
macmdline = Replace(macmdline, ThisWorkbook.FullName, "", , , vbTextCompare)
monparam = Split(macmdline, "/cmd")
Application.Run Mid(monparam(1), 2, Len(monparam(1)) - 3)
End If
End If
End If
End Sub |
Partager