السلام عليكم
Function Nm_Prgram(Nm_Pth As String) As Boolean
Dim In_c As Integer
On Error Resume Next
In_c = GetAttr(Nm_Pth)
Select Case Err.Number
Case Is = 0
Nm_Prgram = True
Case Else
Nm_Prgram = False
End Select
On Error GoTo 0
End Function
Sub Auto_Open()
Dim Pth As String
'===============================
' عادة مسار البرامج
Pth = "C:\Program Files\skype"
If Nm_Prgram(Pth) Then Else MsgBox " برنامج سكاي غير موجود على جهازك": _
ThisWorkbook.Saved = 1: Application.Quit ' امر اغلاق الملف
End Sub