+ Reply to Thread
Results 1 to 12 of 12

Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Hi,
    The below code was originally written to work for excel 2007 and does as follows:
    If BOOK1.xlsm is being used by another user on the network then the code will open BOOK1.xlsm as readonly and at the same time write the password abc123 which protects the workbook, but if no one is using the workbook then the code will open BOOK1.xlsm in regular read-write format and again at the same time write in the password abc123.
    I now use Excel 2010 and when I ran this code on the 2010 version one part of the code did not work, I did not get any error messages but when the code opened the workbook in readonly format i was prompted by excel to enter the password.
    Please Login or Register  to view this content.
    Any help on this issue would be greatly appreciated.

    Thanks in advance.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Why use the write-reserved password if you are opening read-only?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Hi shg,
    Good point i'm not sure myself why it's there lol!
    I took it out but outcome of code remains the same.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Maybe you can open the file manually, remove the writeres password, save, close, then try again.

  5. #5
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Hi shg,
    How do i remove the writers password? The regular password to open the workbook i don't want to remove but i don't see any writers password.
    Please advise.
    Thanks.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Open the file from the user interface, entering both the Open and Write passwords as prompted.

    Then File > SaveAs, Tools > General Options, clear Password to modify, then press Save

  7. #7
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    There is only 1 prompt message to enter password and that password opens the workbook. And when i went into the general opetions there was no password to modify but just a password to open the workbook?

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Then it has no write password.

    However, I don't think that another user having the workbook open changes the file property to read-only; the file is locked, not read-only. I think I have some code as a get-around, but can't help now, sorry -- off to the airport.

  9. #9
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Thanks! Enjoy your flight
    Can i contact you again at a time and day that is convenient for you?

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    Please Login or Register  to view this content.
    It's still possible, though, that someone else opens the file in the fraction of a second between checking it's available and actually opening it.
    Last edited by shg; 12-28-2014 at 02:51 PM.

  11. #11
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    I am utterly speechless!
    I am so happy this issue got resolved and all the thanks goes to you
    Your knowledge in excel is most appreciated, thank you for sharing it with us!
    All the best to you, my friend

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only

    You're welcome.

+ 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. Replies: 0
    Last Post: 12-11-2014, 11:42 AM
  2. Skip The Read Only Prompt When I Open A File - Excel, Open it read-write instead.
    By harry_1805 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2012, 02:14 AM
  3. Replies: 6
    Last Post: 09-28-2005, 10:46 PM
  4. Wrkbk already open by whom?
    By ajliaks in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-23-2005, 03:35 AM
  5. [SOLVED] How to write a macro to open a file read-only?
    By Mark Seger in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 06-05-2005, 09:40 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