+ Reply to Thread
Results 1 to 10 of 10

Old code to "expire sheet" is not working

  1. #1
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Old code to "expire sheet" is not working

    I used the code shown below many years ago to make a workbook expire after a date.
    I am now trying to use it in with a workbook on excel 2016, and its not working.
    I would like it to protect a workbook with 30 sheets (tabs).
    can someone fix this or maybe offer something else that would work?
    I juts want it to expire after a date, with a message.
    Thanks


    Please Login or Register  to view this content.
    Last edited by alansidman; 10-27-2019 at 05:06 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,876

    Re: Old code to "expire sheet" is not working

    Look at post #2 and #3 here: https://www.mrexcel.com/forum/excel-...lete-file.html
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Old code to "expire sheet" is not working

    Not working, I'm missing something.... Are both dates needed? If so, Why two?
    I also don't need it to delete anything, just not open after a date.

    Please Login or Register  to view this content.
    Last edited by AliGW; 10-27-2019 at 05:50 PM. Reason: Code tags fixed.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,876

    Re: Old code to "expire sheet" is not working

    You do not need to enter a second date. The line If Date > Edate +2 Then translates to if Today is greater than the Edate (which you defined as Dec 31, 2012) + 2 days then close the workbook.

    Have you placed the code in a Event Module and not in a standard module. Just to be sure.

    Open the VBE
    In the left window, click on this workbook to open the Workbook event window in the right pane.
    Paste the code in.
    Save and close. Save the file as a macro enabled.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Old code to "expire sheet" is not working

    This works fine for me.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Old code to "expire sheet" is not working

    OK, Thanks. Works fine. I had it in an improper module.
    A follow up question...….
    Before, (with an old 2003 excel version) I could open an expired module (At least look at it) by holding down "shift" and
    right clicking on the file as "Open as Read Only", then I would go to the password protected VBA to edit the expire date.
    With excel 2016, that does not seem to work. Is there a way to see the VBA with the 2016 version, on an expired file?
    Last edited by richard11153; 10-28-2019 at 07:26 AM. Reason: A mistake

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,876

    Re: Old code to "expire sheet" is not working


  8. #8
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Old code to "expire sheet" is not working

    Thats a video for MS 2010. (Not like that in 2016 version)

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Old code to "expire sheet" is not working

    Did you try this ?

    Open an instance of Excel.
    Click the Office-button and select Open.
    Select your file and hold down the Shift-button while clicking the Open button.
    This should prevent the macro's from kicking in.

  10. #10
    Forum Contributor
    Join Date
    11-26-2008
    Location
    Ohio
    MS-Off Ver
    2016
    Posts
    326

    Re: Old code to "expire sheet" is not working

    OK, That let me open the "expired workbook file" But...….
    The macros that I put in "worked". The file was usable!!
    Last edited by richard11153; 10-28-2019 at 05:25 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy Data from "Source" Sheet to "Target" Sheet (Code need help thanks)
    By mankit87 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-17-2019, 11:45 PM
  2. [SOLVED] How to code delete all value of "Blank" this code is working but 1 Row at a time.
    By Chandria in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-30-2019, 01:15 AM
  3. VLOOKUP not working for sheet 1 called "2016" in "Jobs.xlsx"
    By A2G in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-19-2016, 11:53 AM
  4. [SOLVED] Code that copies row of data to another sheet based on text "Complete"/"Delete"
    By Dremzy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-20-2014, 05:51 PM
  5. Replies: 2
    Last Post: 04-20-2014, 11:18 AM
  6. Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" not working
    By redders in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2011, 03:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1