+ Reply to Thread
Results 1 to 12 of 12

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

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

    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?


    Please Login or Register  to view this content.
    Your thoughts?

    Thanks,

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

  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    915

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

    Do you mean that you need to update this line of code: Private Const NUM_DAYS_UNTIL_EXPIRATION = 30 ?
    I would say that you need another approch, I read in your macro ExpDate = Mid(ThisWorkbook.Names("ExpDate").Value, 2) and this means that the information is part of the file name.

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

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

    Hi rollis13,
    I have been doing some research across the web and I understand that it may be possible to overwrite a module that is already part of the workbook.

    What solution do you recommend?

    Regards,

    John

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

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

    You don't need a new module, since the code itself is fine, it's just that the workbook contains a defined name with a date in it. You could presumably just send them a new copy of the workbook.
    Rory

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

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

    Rorya,

    Thanks for your feedback...

    The code references a workbook named "ExpDate".

    My workbook in question has thousands of records and a large array of code involving up to 50 modules that run the workbook. Thus the importance to find a solution that updating the Module seems to be the logical approach that I want to investigate... this could be by possible a UserForm that can import the module and thus resetting the expiration date.

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

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

    Also I discovered this potential solution in where the module is exported and then imported...

    Copy A Module From One Project To Another

    There is no direct way to copy a module from one project to another. To accomplish this task, you must export the module from the Source VBProject and then import that file into the Destination VBProject. The code below will do this. The function declaration is:

    Function CopyModule(ModuleName As String, _
    FromVBProject As VBIDE.VBProject, _
    ToVBProject As VBIDE.VBProject, _
    OverwriteExisting As Boolean) As Boolean

    ModuleName is the name of the module you want to copy from one project to another.

    FromVBProject is the VBProject that contains the module to be copied. This is the source VBProject.

    ToVBProject is the VBProject in to which the module is to be copied. This is the destination VBProject.

    OverwriteExisting indicates what to do if ModuleName already exists in the ToVBProject. If this is True the existing VBComponent will be removed from the ToVBProject. If this is False and the VBComponent already exists, the function does nothing and returns False.

    The function returns True if successful or False is an error occurs. The function will return False if any of the following are true:

    FromVBProject is nothing.
    ToVBProject is nothing.
    ModuleName is blank.
    FromVBProject is locked.
    ToVBProject is locked.
    ModuleName does not exist in FromVBProject.
    ModuleName exists in ToVBProject and OverwriteExisting is False.




    Please Login or Register  to view this content.

    Thoughts??
    Last edited by JJFletcher; 02-10-2021 at 11:58 AM.

  7. #7
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    915

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

    Sorry, but managing vbe modules on external files goes fare beyond my minimal experience.

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

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

    Thank You!

    I appreciate you providing insight

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

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

    Quote Originally Posted by JJFletcher View Post
    The code references a workbook named "ExpDate".
    No, it doesn’t. On startup, it checks for the existence of a defined name called ExpDate. If it’s not there, (which means it’s the first run of the code) it creates it and assigns the current date + 30 days to it, then saves the workbook. It then checks to see if today’s date after the date stored in that defined name. If it is, you get a message and the workbook closes.

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

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

    The upshot of that is that changing that module would have no effect whatsoever. You need to alter the date in the defined name stored in that workbook.

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

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

    rorya,

    Thanks for the feedback again... I will try to get this to be understandable so I can update the expiration date in the workbook with an import macro of some kind...

    Maybe another workbook (UserForm) that sends the update to the first workbook and changes(REfreshes) the expiration date... UGH!

    Regards,

    John

  12. #12
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

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

    In all honesty, this would be so easy to bypass, I’m not really sure why you bother, but it sounds like you should separate the code and data so that you can simply provide a fresh code workbook. Or use a separate licence key file in which you can hide a date string, so you just send them a new one of those.

+ 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] 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