Yahoo Answers akan ditutup pada 4 Mei 2021 dan situs web Yahoo Answers sekarang tersedia dalam mode baca saja. Tidak akan ada perubahan pada properti atau layanan Yahoo lainnya, atau akun Yahoo Anda. Anda dapat memperoleh informasi lebih lanjut tentang penutupan Yahoo Answers dan cara mengunduh data Anda di halaman bantuan ini.

Ana Dewi ditanyakan dalam Computers & InternetSoftware · 7 tahun yang lalu

VBA or macro procedure for excel workbook expired date?

Dear friend, could I ask some help? I took some VBA codes for expire date. These codes worked and my message box "This file has expired" was working but when an option for saving file appear with these option "Do you want to save file, Yes, No, Cancel?", I tried to click Cancel option but my workbook was not closed, it still opened. What code could be added to expired date codes to make my workbook keep closed whatever the option for saving file?

Here are my codes, and thanks in advanced. Sorry for my bad redaction.

Private Sub Workbook_Open()

Dim Exdate As Date

Exdate = Format("10/03/2014", "DD/MM/YYYY")

If Date > EDate + 2 Then

MsgBox "This file expired, please call for the contact person"

ActiveWorkbook.Close

End If

End Sub

1 Jawaban

Relevansi
  • 7 tahun yang lalu
    Jawaban Favorit

    There is an optional parameter in close procedure that instruct the application to save or not. Just append False to discard any changes. Your close method should read:

    ActiveWorkbook.Close False

Masih ada pertanyaan? Dapatkan jawaban Anda dengan bertanya sekarang.