+ Reply to Thread
Results 1 to 5 of 5

Create Macro to lock and save workbook and another to unlock

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    84

    Create Macro to lock and save workbook and another to unlock

    Hi,

    Im new to macros and VB so not sure how to adapt this code. I am looking to create a button and assign a macro that will lock(with password) the workbook and save. Upon locking I want the users name to appear in a cell and the save date/time. I want to create another button which will allow the user to unlock(with password) the workbook. I dont want users to be able to save the workbook without locking.

    I found this code for locking and unlocking the entire workbook. This works fine but need the save incorporated into it.

    Hope someone can help!


    Please Login or Register  to view this content.
    Last edited by Cutter; 08-31-2012 at 08:52 PM. Reason: Added code tags

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Create Macro to lock and save workbook and another to unlock

    Hello,

    The following lines of code will place the username in a cell, the current time and date in another and then save the workbook with changes:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Create Macro to lock and save workbook and another to unlock

    @ Nicola13

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

  4. #4
    Registered User
    Join Date
    08-29-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2010
    Posts
    84

    Re: Create Macro to lock and save workbook and another to unlock

    @rvasquez - This works great for adding the user name and date/time but I am getting a compile error (wrong number of arguements or invalid property assignment) for the save workbook with changes?

    @Cutter - Sorry about that I didnt see that in the rules. Will make sure I do this from now on. thanks!

    ---------- Post added at 03:45 AM ---------- Previous post was at 03:41 AM ----------

    @rvasquez - Got it working now. I removed the True and it worked. Thank you for your help

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Create Macro to lock and save workbook and another to unlock

    @ Nicola13

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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