Bir Dosyanın Olup Olmadığını Öğren - Microsoft Excel


Tam yolu verilen bir dosyanın mevcut olup olmadığını gösteren VBA kodu alternatifidir.

Kod


Option Explicit

Sub BirDosyaninOlupOlmadiginiOgren()
    Dim fileSystemObject As Object
    Dim dosyaKontrol     As Boolean
    
    Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
    dosyaKontrol = fileSystemObject.FileExists( _
        "C:\OrnekKlasor\CalismaKitabi2.xlsx")
    
    If dosyaKontrol = True Then
        MsgBox "Dosya bulundu.", vbOKOnly
    Else
        MsgBox "Dosya bulunamadı.", vbCritical
    End If
End Sub

Etiketler
microsoft excel microsoft excel vba microsoft excel vba dosya klasör işlemleri