+ Reply to Thread
Results 1 to 6 of 6

Create Macro that asks for read only or read-write access

  1. #1
    Registered User
    Join Date
    05-17-2018
    Location
    New York
    MS-Off Ver
    2007
    Posts
    4

    Create Macro that asks for read only or read-write access

    Hi everyone,

    I'm trying to create a macro that after opening an Excel doc, a popup appears that asks the user if he wants "Read Only" or "Read-Write" access. The user should be able to click a "Read Only" or a "Read-write" button, which will then determine their access to the doc. How do I go about coding this?

    Thanks,
    Evan

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Create Macro that asks for read only or read-write access

    Hi Evan,

    You could use something like the below in the workbook module for a quick and dirty approach.
    Please Login or Register  to view this content.
    If you actually want buttons that say 'Read Only' / 'Read Write' then you'll be better off designing a simple userform that is opened in the workbook open event and similar code is run depending on which button is clicked.

    Hope that helps. Feel free to ask questions if you need more help.

    BSB

  3. #3
    Registered User
    Join Date
    05-17-2018
    Location
    New York
    MS-Off Ver
    2007
    Posts
    4

    Re: Create Macro that asks for read only or read-write access

    So right now my doc is in Read Only mode, and I used your code to change it to Read-Write if the user hits Yes, but when I hit Yes I get a prompt saying to save as a different file. How should I fix that so I dont get a prompt to save as a different file?

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Create Macro that asks for read only or read-write access

    Maybe this?
    Please Login or Register  to view this content.
    BSB

  5. #5
    Registered User
    Join Date
    05-17-2018
    Location
    New York
    MS-Off Ver
    2007
    Posts
    4

    Re: Create Macro that asks for read only or read-write access

    It's still asking me to save as a different file. I've been looking up this problem, and I've seen some suggestions to incorporate Workbook.Saved=True somewhere in the code. After which line of code should I put this expression in?

  6. #6
    Registered User
    Join Date
    05-17-2018
    Location
    New York
    MS-Off Ver
    2007
    Posts
    4

    Re: Create Macro that asks for read only or read-write access

    I put ThisWorkbook.Saved=True near the beginning, and the workbook did change to Read Write after I ran the code, but the new code changed back to the old code I had when posting my question. Kind of solved?!?!

+ 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. [SOLVED] Macro to open wrkbk & enter psswrd whether wrkbk is read write or read only
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-25-2014, 01:16 AM
  2. [SOLVED] Checking to see if a file has been opened in Read/Write or Read Only
    By brokenbiscuits in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2014, 09:16 AM
  3. write on an excel file over the network that user only has read-only access to
    By vangxbg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2013, 08:41 AM
  4. Read an Write Access DB
    By phil_ono in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-14-2009, 11:35 AM
  5. Only execute code on a write-access basis, not read-only
    By thompsy121 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2009, 07:02 AM
  6. Read/Write Access DB from VBA in Excel
    By excelbobabc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2008, 05:45 PM
  7. Read Write Access Restrictions
    By facmess1 in forum Excel General
    Replies: 2
    Last Post: 02-21-2007, 05:05 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