Çalışma Kitabına Demo Süresi Koy - Microsoft Excel


Verilen tarih bilgisine göre çalışma kitabının açılıp açılmamasını sağlayan VBA kodudur.

Kod


Option Explicit

Sub Auto_Open()
    Dim bitisTarihi As Date
    Dim mesajMetni  As String
    
    bitisTarihi = "25.09.2022"
    
    If Date > bitisTarihi Then
        MsgBox ("Kullanım süresi dolmuştur.")
        ActiveWorkbook.Close
    End If
    
    mesajMetni = bitisTarihi - Date & " GÜN"
    
    MsgBox mesajMetni, vbOKOnly + vbInformation, _
        "Kullanım Süresinin Dolmasına Kalan Gün"
End Sub

Etiketler
microsoft excel microsoft excel vba