Consulting

Results 1 to 2 of 2

Thread: read write access using VBA

  1. #1

    read write access using VBA

    Hi all,

    Is there a code we can write so that when i cklick a button the excel has only read-only access and by clicking another button, it gets both read and write access? :confused:

    Regards
    Jacob

  2. #2
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Ummm... maybe. It depends on how you're trying to go about this.

    If you want true read only access at the file level, you can set the properties of the Excel workbook to Read Only at the operating system level. You'd then need a windows API call to flip it to Read/Write. As I recall, though, you can't save the file using the same name as the file you opened as read only though, so saving an update could be tricky.

    If you're just trying to prevent users from modifying the data in the file though, worksheet protection is going to be a LOT easier to implement...

    If you give us a bit more idea of your ultimate objective, we could pursue the better of the options with you.
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •