+ Reply to Thread
Results 1 to 6 of 6

Password Protect Code Module Using VBA Code

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Password Protect Code Module Using VBA Code

    Hi,

    Is there a way to Password Protect Code Module Using VBA Code?

    I have a code that generated multiple Workbooks with codes in it.. I just want to password protect the code modules while the Workbooks are being generated.

    Anyway of doing it?

    Cheers!
    Cheers!
    Deep Dave

  2. #2
    Valued Forum Contributor
    Join Date
    06-02-2012
    Location
    London, England
    MS-Off Ver
    365
    Posts
    397

    Re: Password Protect Code Module Using VBA Code

    I'm not sure there is a simple programmatic method of locking the VBA project using VBA.
    You could do it with a list of SendKeys commands to simulate the process being carried out manually.

    Beth.

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Password Protect Code Module Using VBA Code

    Hi,

    Thanks for the reply..

    I actually knew about that solution.. Just wanted to know if there is a better way..

    I have been reading about it and I understand that there is no way to do it using any exposed properties.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Password Protect Code Module Using VBA Code

    You can use APIs which are a little more reliable than sendkeys, but there's no simple method.
    Remember what the dormouse said
    Feed your head

  5. #5
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: Password Protect Code Module Using VBA Code

    Hi rorya,

    Thanks for the response, and apologies for the delay in responding.

    Can you direct me towards any such API which can probably help me?

    Cheers!
    Deep

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Password Protect Code Module Using VBA Code

    Here's an idea of the APIs you need: http://www.standards.com/Office/SetV...tPassword.html
    It would need some adapting to use from Excel rather than VB6.

+ 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. VB Code to password protect VB Module to avoid other seeing the code
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2015, 11:33 AM
  2. VB code to protect password
    By sshrikanth2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2014, 10:55 AM
  3. [SOLVED] [VBA CODE] Password Protect a hidden sheet while using other code
    By cityinbetween in forum Excel General
    Replies: 11
    Last Post: 09-26-2014, 03:15 AM
  4. [SOLVED] Unprotect VBA - Run Code - Protect again (password is known)
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-10-2012, 09:35 AM
  5. Protect Sheet & Password Protect Code
    By KLahvic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-13-2009, 04:08 PM
  6. Please help!!! Using code to password-protect and unprotect...
    By Hawk in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-09-2005, 06:05 PM
  7. [SOLVED] Protect Sheet - VB code to specify password
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2005, 05:06 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