+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Password protected workbook saveas

  1. #1
    Registered User
    Join Date
    03-09-2008
    Posts
    10

    Password protected workbook saveas

    Hi all,

    I have a problem with my 2007 workbook. The workbook is password protected so you can't open it without a password. My problem comes when I save a worksheet from the workbook (ActiveWorkbook.SaveAs) in VBA and I subsequently open the newly created workbook. It wants me to enter the password twice - once to open the workbook (I want this) and then asks me to enter the password again (don't want this).

    Suggestions please?

  2. #2
    Forum Contributor
    Join Date
    06-14-2008
    Posts
    153
    Hi,

    While saving leave the second password (password to modify) blank i.e don't enter anything there. This way Excel will ignore it, and when someone open the workbook for reading it will only ask for one password.

    Regards.

    Note:

    I am using Excel 2003, and I hope Excel 2007 has the same behavior.
    Welcome to: http://www.exceldigest.com/myblog/
    "Excel help for the rest of us"

  3. #3
    Registered User
    Join Date
    03-09-2008
    Posts
    10

    RE: Password protected workbook saveas

    Thanks for your reply. I did as you suggested but it doesn't work. When I don't specify a password on the saveas (or blank password) then Excel opens the workbook (with only 1 prompt for a password). So this essentially removes the protection on the new workbook. I need the worksheet to be protected but with only 1 prompt when opening the workbook. I hope this makes sense.

  4. #4
    Forum Contributor
    Join Date
    06-14-2008
    Posts
    153
    Hi Salomon,

    If you want to protect an individual sheet to prevent data entry then you can add this line before the 'saveas' code:

    Please Login or Register  to view this content.
    Here is a complete macro that I recorded and tested:

    Please Login or Register  to view this content.
    In case you need more info, here is acouple of links:

    http://www.exceldigest.com/myblog/20...n-a-worksheet/
    http://www.exceldigest.com/myblog/20...heet-elements/

    I hope that I understood you correctly, and that my reply provides some help.

    Regards.

  5. #5
    Registered User
    Join Date
    03-09-2008
    Posts
    10

    RE: Password protected workbook saveas

    Thanks for the response. Unfortunately it doesn't address my original post and my problem I posted.

    I appreciate the assistance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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