+ Reply to Thread
Results 1 to 4 of 4

set password to VBA code in .xlsx file

  1. #1
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    set password to VBA code in .xlsx file

    Hi all,

    I have the following situation:
    I've built a file for other users without macros (or other VBA) and saved as .xlsx
    Now I want to protect it from users writing VBA code (to get to the protected cells of the file).
    Of course they would have to save the file as .xlsm to be able to use the VBA, but I'd like to prevent them from even getting to the VBA project viewer.

    I know I can do this in a .xlsm file with a password, but it doesn't seem to work for my .xlsx file. When I set a password, close the file and open it again, you can get to the (empty) code without Excel asking for the password. Is this because it is not a .xlsm file?
    When I say semicolon, u say comma!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: set password to VBA code in .xlsx file

    To be honest, you're wasting your time. If someone can write VBA code to access your protected workbook/worksheets, they can write it, and save it, in a separate .xlsm file. The code in this workbook can refer to the workbook and worksheets and, without much effort, remove any protection you have put in place.

    your file will probably be relatively safe from a typical user but, for a user with VBA skills, it will never be secure.

    Sorry to be the bearer of bad news but you may as well save yourself some time.

    If it needs to be secure, you would be better off investing in a third party product like Spreadsheet Sentry.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: set password to VBA code in .xlsx file

    O haha didn't even think of that

    Then I'll just live with it, no big deal.

    Thanks for the help!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: set password to VBA code in .xlsx file

    You're welcome. Thanks for the rep.

+ 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: 6
    Last Post: 08-28-2012, 03:51 AM
  2. How to add the columns data of several xlsx files of a folder in another xlsx file
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-25-2012, 04:29 AM
  3. [SOLVED] Forgot Excel 2007 (.xlsx) file open password
    By VidyaSagar in forum Excel General
    Replies: 1
    Last Post: 03-02-2012, 09:18 AM
  4. VBA for excel 2003. Open file dialog box, open 2007 file xlsx, continue with code
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2011, 12:12 AM
  5. forgot password for xlsx file
    By associates in forum Excel General
    Replies: 2
    Last Post: 04-03-2011, 11:51 AM

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