+ Reply to Thread
Results 1 to 10 of 10

Unprotect Visual Basic Editor

  1. #1
    Registered User
    Join Date
    12-21-2018
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    6

    Unprotect Visual Basic Editor

    Hi All,

    Hope this message finds you well.

    Is it possible to instruct a macro to unlock vba in another workbook that has been password protected?

    I know the password - this is not a hack!

    I thought something along the lines of: vbproject.unprotect password:="Password1"

    Is this possible?

    Thanks,

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

    Re: Unprotect Visual Basic Editor

    Just out of interest, what's the purpose of unlocking the VBA?

    BSB

  3. #3
    Registered User
    Join Date
    12-21-2018
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    6
    Basically I sent out a workbook template containing protection to avoid tampering with code.

    Now I want to remotely update the code in the template that has been used in multiple instances.

    I can write the code to insert or amend modules, but am stuck at trying to remotely unlock the VBA protection to update..
    Last edited by AliGW; 06-09-2019 at 04:13 AM. Reason: Please don't quote unnecessarily!

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

    Re: Unprotect Visual Basic Editor

    You could use SendKeys to simulate you opening the VBE and removing the password.

    Personally I would write code that replaces the current version of the file with the update version (copying any data from old to new) and leave the VBA locked away.

    BSB

  5. #5
    Forum Contributor
    Join Date
    03-08-2018
    Location
    Denmark
    MS-Off Ver
    2016 for Windows
    Posts
    413

    Re: Unprotect Visual Basic Editor

    interesting question, as I am looking for something similar.
    I am looking for a way to update the workbook open event, and I also have my VBE protected.
    Following this thread with great interest.

  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: Unprotect Visual Basic Editor

    Why not implement the workbook as an add-in and store read-only in a network share?
    Entia non sunt multiplicanda sine necessitate

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

    Re: Unprotect Visual Basic Editor

    Here is a SendKeys one that will work with a little tinkering.

    Cannot find where I originally pinched it from but it's been sat in the "This might come in useful" folder for several years now...

    Please Login or Register  to view this content.
    BSB

  8. #8
    Forum Contributor
    Join Date
    03-08-2018
    Location
    Denmark
    MS-Off Ver
    2016 for Windows
    Posts
    413

    Re: Unprotect Visual Basic Editor

    Thanks BadlySpelledBuoy

    This will come in handy, if I get it to work.
    I have not tryid it yet.

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

    Re: Unprotect Visual Basic Editor

    No problem. Good luck with it.

    BSB

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Unprotect Visual Basic Editor

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. Referencing in Mac Visual Basic Editor
    By no.18shirt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2013, 03:15 PM
  2. [SOLVED] How to run module in visual basic editor
    By jewellove in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2012, 12:16 AM
  3. Line Nos. in Visual Basic Editor
    By apka in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-12-2012, 05:43 PM
  4. [SOLVED] Can I run Visual Basic procedure using Excel Visual Basic editor?
    By john.jacobs71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-26-2005, 10:25 AM
  5. Visual Basic Editor for Excel
    By JoeABC in forum Excel General
    Replies: 1
    Last Post: 08-11-2005, 11:05 PM
  6. VBE(Visual Basic Editor) Keep focus in VBE
    By phil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-10-2005, 08:05 PM
  7. [SOLVED] Visual Basic Editor Question???
    By Flames in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2005, 05:06 AM

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