Working with vba expiration date. Need to rescue my workbook if possible!

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi!
In one of the workbook, i use a code like this...when it reaches expiry date it gvies pop up...& then closes it...so there is no way (as for me I dont know a way) to stop it from closing as u all know how fast the macro is....I was trying to re-open and change the setting but it does not allow me to do anything now as it has expired. Is there a way i can make changes to this macro from another code or something???:biggrin:


Please advice if you've any idea....!!!



Code:
Sub Auto_Open()
    Dim exdate As Date
    exdate = "7/30/2010"
    If Date > exdate Then
        MsgBox ("You have reached end of your trial period")
        ActiveWorkbook.Close
    End If 
    MsgBox ("You have " & exdate - Date & "Days left")
End Sub
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
You can hold down the Shift key when you open the workbook to halt code execution. Or disable macros, then open the WB.

Also note that you can avoid this in the future by putting a user name test in the code - if the code sees that it's you it'll exit, otherwise execute.

HTH,
 

PA HS Teacher

Well-known Member
Joined
Jul 17, 2004
Messages
2,838
Open another workbook, or start a new one.

Set the Security to High.

Open the workbook in question, and change the date as necessary. Save and close the file.

Lower the security back to its previous setting.
 

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Smitty, hi!
thanks for advice...i'll give it a try..not sure about the user thing..but if you could design me a sample code or something would be great....!;)

PA HS Teacher, thanks for inputting..do you mean like turning of the macro so that it wont do anything??? and then i can open it as normal book???
 

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Wow...disabling all macros did the job!!!!

Thanks guys..i think i'll nto trouble you guys more then I should...:biggrin:


Good night!;)
 

russell11875

New Member
Joined
Apr 13, 2019
Messages
1
You can hold down the Shift key when you open the workbook to halt code execution. Or disable macros, then open the WB.

Also note that you can avoid this in the future by putting a user name test in the code - if the code sees that it's you it'll exit, otherwise execute.

HTH,
This worked for me. Thank you for sharing. 👍
 

Watch MrExcel Video

Forum statistics

Threads
1,109,315
Messages
5,527,957
Members
409,794
Latest member
ajithppajith

This Week's Hot Topics

Top