+ Reply to Thread
Results 1 to 4 of 4

Close Workbook after openning X times

  1. #1
    Forum Contributor
    Join Date
    06-25-2012
    Location
    Porto, Portugal
    MS-Off Ver
    Excel 2010
    Posts
    201

    Close Workbook after openning X times

    Hi... i need a macro that runs on opennig the workbook so it can check how may times the file was openned in that computer and then closes it after it reaches the amounted number of times. Lets say i have a file that as a Trial need it to open a maximum of 10 times. So when it opens it starts to count and when reaches 10th time openned it closes saying something like: " Your trial period has expired. Please buy the full version."

    Thank you

  2. #2
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Close Workbook after openning X times

    I don't know the code to do it, but you could set a cell on a hidden/protected sheet that is increased by 1 each time the workbook is opened. Then, when the workbook is opened, the macro's first task is to check the value of that cell. if it is less than your limit, increase the cell value by 1, if it is over the limit then show a 'Trial Expired' message and close the workbook.

    Only one problem with that method... if people disable macros from running it won't work. =)

    - Moo

  3. #3
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Close Workbook after openning X times

    Try it ten times.

    Please Login or Register  to view this content.
    Kind regards, Harry.

  4. #4
    Forum Contributor
    Join Date
    06-25-2012
    Location
    Porto, Portugal
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: Close Workbook after openning X times

    @HSV,

    Thank you very much. Worked like a charm.

    Moderator's Note: As per Forum Rule #12, don't quote whole posts unless necessary-- it's just clutter...Thanks.
    Last edited by jeffreybrown; 12-15-2012 at 11:08 AM.

+ 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