+ Reply to Thread
Results 1 to 16 of 16

Delete Macro Forever

  1. #1
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Exclamation Delete Macro Forever

    I've made a macro program, and I've kept password on it. Is there any code/ way to delete the whole macro/ modules on a fixed date or time?

    for example - If I want to keep alive my macro program just for next 100 days, then is there any code, which I can put in a module to destroy/disable the program automatically after 100 days?

    If it can happen, then there should be a message too, which can tell abt the program is going to be delete after 3 days, then 2 days, then 1 day ....and later nothing to see and run there.
    Last edited by SunOffice024; 09-25-2010 at 11:52 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Macro Forever

    Hello SunOffice024,

    This macro will remove all macros in the workbook, including itself. Now you just need some code to detect if 100 days have passed since it was installed.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Delete Macro Forever

    Hi Leith
    Is there any way to run the code with VBA protection or a way to open VBA modules with know password from with in?
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Delete Macro Forever

    Leith I think I've got it with sendkeys and searching

  5. #5
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Delete Macro Forever

    Thanks Mr Leith Ross for ur codes!

    What if I want a particular date instead of 'number of days', so the macro program will be deleted after a fixed date by itself whether the VBA protection in on?

    ...and before deleting the VBA project, If it can happen then the users can get a daily message, which can tell them about the program is going to be deleted after 3 days, then 2 days, then 1 day ....and later nothing to see and run there.

  6. #6
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Delete Macro Forever

    Mr Pike...but I don't.
    Last edited by SunOffice024; 09-26-2010 at 07:40 AM.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Macro Forever

    Hello SunOffice024,

    What do you have password protected: Workbook, Worksheet, or VBA Project?

    Rob: SendKeys is not very reliable for initiating actions. Unfortunately, VBA doesn't have a built-in method or property to supply the VBA Project password to active project. However, I do know of another method, but it violates the forum rules regarding security so that isn't an option.

  8. #8
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Delete Macro Forever

    No, plz don't take it wrong!

    I mean that I've made a macro enabled project in ms excel, now wht I want to do that - to secure my codes & idea, I would keep the VBA protection in on.
    ..but one more thing I would like to add in my project that my project will run just for a particular day/ date. After tht day/ date the whole VBA project must be disabled/ destroyed forever, and before deleting my codes one/user can get a notification message, for example - this VBA project will be no longer after this date. This is how my project will be useful for a limited time.

    I hope u'd have got me by the above posts & examples!
    Last edited by SunOffice024; 09-26-2010 at 03:23 PM.

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Macro Forever

    Hello SunOffice024,

    I will need to test some ideas for setting a limit on the days. Not sure if the code will delete the macros if the VBA project is protected. Seems to me that should not be a problem since the macro is already in the project. Best not to assume.

  10. #10
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Delete Macro Forever

    Hi Mr. Leith Ross,

    Okay, plz take your time. I have enough confidence on you guys will get the solution for me.

    The same idea was in mind, if the codes for VBA deleting is already in the project, then the required action can be performed by itself whether the VBA protection is on?

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Delete Macro Forever

    Hello SunOffice024,

    I believe that is true. Since I have never done this with the project protected, it will need to tested to be sure it works.

  12. #12
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Delete Macro Forever

    Okay...!

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Delete Macro Forever

    How about using the c drive temp folder to store a text file.The file is created and dated the file was first opened

    On second third opening it checks to see if the file exist and if not creates one with time stamp.if yes it reads the date and deletes after 15 days ect...

    everyone has a temp file and I use it to store text file when work with other application

  14. #14
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Delete Macro Forever

    As long as the user will be able to turn off macro execution, he/she will be able to modify the VBA-code to prevent any code deletion at a certain moment.



  15. #15
    Registered User
    Join Date
    09-22-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Delete Macro Forever

    sorry, I don't get ur words... kindly explain more with the text file codes which I need to place in temp folder.

  16. #16
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Delete Macro Forever

    snb is right there is no point because users can open the module and change the delete code.. better off having an expiry date in the code so if the date in the code is pasted it dosent work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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