|
"Dosya Bulunamadı uyarısı"
Arkadaşlar aşağıdaki kodla dosyanın çalışmasını sağlayabiliyorum. Ancak benim istediğim, dosya yoksa kendi hatasını vermesi yerine benim yazdığım hatayı çalıştırması
Private Sub Command1_Click()
Dim Dsy As String Dsy = Shell(App.Path & "Setup.exe")
If Dsy = vbNull Then If Err.Number = 53 Then Err.Clear MsgBox "Dosya Bulunamadı" & Chr(10) & "Lütfen Dosyanın bulunduğu KLASÖRÜ kontrol edin..!", vbInformation
Else End If End Sub
Said | 09.03.2010 10:48
|
Private Sub Command1_Click() Dim Hatakontrol Dim HataNo
On Error GoTo Hatakontrol Hatakontrol: HataNo = Err Select Case HataNo Case 53 MsgBox "Dosya Bulunamadı" & Chr(10) & "Lütfen Dosyanın bulunduğu KLASÖRÜ kontrol edin..!", vbInformation 'Dosya Bulunamazsa ayrıca yapılmasını istediğin işlem varsa Exit Sub dan önce buraya yazabilirsin Exit Sub End Select
Dim Dsy As String Dsy = Shell(App.Path & "Setup.exe")
End Sub
bestshow3 | 10.03.2010 00:43 | Sn. bestshow3;
Modül kısmına:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Declare Function GetDesktopWindow Lib "user32" () As Long
Public Function OpenFile(ByVal DocName As String) As Long Dim Scr_hDC As Long Scr_hDC = GetDesktopWindow() OpenFile = ShellExecute(Scr_hDC, "Open", DocName, "", "C:", 1) End Function
Combonun Eventine
Private Sub Command1_Click()
dsy = OpenFile(App.Path & "ETF_TCKimlikNo.exe")
If dsy = 2 Then MsgBox "Dosya Bulunamadı" Else End If End Sub
Yazarak istediğimi elde ettim. Yardım ve verdiğiniz fikir için çok teşekkür ederim.
Said | 10.03.2010 09:08 |
|