Results 1 to 12 of 12

upload a new Module to overwrite previous module to update expriration date!

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    991

    upload a new Module to overwrite previous module to update expriration date!

    Hello,

    I found this expiration code and wanted to see if there is a way that when the time lapses that an update file can be sent to the User and reset the date in this code to the desired number of days in that update.

    This code shows a 30 day period and then the Excel file is stopped.

    Is there a way that a new Module can be loaded into the workbook and overwrite this Module and that would contain the new expiration date?


    ' Update this variable to set your own expiration period by number of days
    Private Const NUM_DAYS_UNTIL_EXPIRATION = 30
    
    Private Sub Expiration_Date()
    
        Dim ExpDate As String
        
        On Error Resume Next
        ExpDate = Mid(ThisWorkbook.Names("ExpDate").Value, 2)
        If Err.Number <> 0 Then
            ' Name doesn't exist.
            ' Calculate new expiration date
            ExpDate = CStr(DateSerial(Year(Now), _
                Month(Now), Day(Now) + NUM_DAYS_UNTIL_EXPIRATION))
            ' Create a named range and store the date in the named range
            ThisWorkbook.Names.Add Name:="ExpDate", _
                RefersTo:=Format(ExpDate, "short date"), _
                Visible:=False
            ' Save the file
            ThisWorkbook.Save
        End If
        
        ' Comapare today and expriation date
        If CDate(Now) > CDate(ExpDate) Then
            ' Expired
            MsgBox "Your StatsSystems subscription has EXPIRED, Please contact sales@statssystems.com to Re-Subscribe.", vbOKOnly
            ThisWorkbook.Close savechanges:=False
        End If
    
    End Sub
    Your thoughts?

    Thanks,

    John
    Last edited by JJFletcher; 02-10-2021 at 10:12 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Fiscal Year Date tracking / Expiration date tracker
    By TylerLucas227 in forum Excel General
    Replies: 3
    Last Post: 10-09-2019, 11:46 PM
  2. Adding Expiration Date and Days Left For Expiration Problem
    By Newmord in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2018, 09:37 AM
  3. Calculate 1-year expiration date to the end of month of a date
    By Dietcoke1953 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-18-2016, 01:20 PM
  4. Expiration Date safe from changing computer's date
    By backyardfun in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2014, 05:58 PM
  5. Expiration Date
    By stevenchaplin in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-23-2013, 03:56 PM
  6. set expiration date
    By nhat8121 in forum Excel General
    Replies: 13
    Last Post: 01-05-2007, 10:02 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